import os
# Specify the path to count files and directories
PATH = r'C:\Users\IRAWEN\Downloads\1050'
files, dirs = 0, 0
for root, dirnames, filenames in os.walk(PATH):
print('Looking in:', root)
dirs += len(dirnames)
files += len(filenames)
print('Files:', files)
print('Directories:', dirs)
print('Total:', files + dirs)
#source code --> clcoding.com
Looking in: C:\Users\IRAWEN\Downloads\1050
Files: 111
Directories: 0
Total: 111
0 Comments:
Post a Comment