Answers for "total number of files in a folder and subfolder python"

0

total number of files in a folder and subfolder python

import os

APP_FOLDER = 'C:/Positronx/Python/Scripts/'

totalFiles = 0
totalDir = 0

for base, dirs, files in os.walk(APP_FOLDER):
    print('Searching in : ',base)
    for directories in dirs:
        totalDir += 1
    for Files in files:
        totalFiles += 1


print('Total number of files',totalFiles)
print('Total Number of directories',totalDir)
print('Total:',(totalDir + totalFiles))
Posted by: Guest on June-01-2021

Code answers related to "total number of files in a folder and subfolder python"

Python Answers by Framework

Browse Popular Code Answers by Language