Answers for "how to count number of files in a folder python"

6

python count files directory

import os
len(os.listdir(directory))
Posted by: Guest on April-03-2020
0

python monitor directory for files count

import os.path
path = os.getenv('HOME') + '/python'
num_files = len([f for f in os.listdir(path)if os.path.isfile(os.path.join(path, f))])
Posted by: Guest on November-27-2020

Code answers related to "how to count number of files in a folder python"

Python Answers by Framework

Browse Popular Code Answers by Language