Answers for "how to list the number of file in 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 list the number of file in python"

Python Answers by Framework

Browse Popular Code Answers by Language