Skip to content

Commit c398331

Browse files
authored
Add files via upload
1 parent 5f88481 commit c398331

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
3+
#path where we have to count files and directories
4+
path = input("Enter path: ")
5+
6+
noOfFiles = 0
7+
noOfDir = 0
8+
9+
for base, dirs, files in os.walk(path):
10+
print('Looking in : ',base)
11+
for directories in dirs:
12+
noOfDir += 1
13+
for Files in files:
14+
noOfFiles += 1
15+
#print number of files,directories,total
16+
print('Number of files',noOfFiles)
17+
print('Number of Directories',noOfDir)
18+
print('Total:',(noOfDir + noOfFiles))
23.5 KB
Loading

0 commit comments

Comments
 (0)