-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDirectoryTravel-1.py
47 lines (34 loc) · 1.16 KB
/
DirectoryTravel-1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from sys import *
import os
def DirectoryTraveler(path):
flag = os.path.isabs(path)
if flag==False:
path = os.path.abspath(path)
exists =os.path.isdir(path)
if exists:
for Foldername ,subFolder , Files in os.walk(path):
print("Current folder is : ",Foldername)
for File in Files:
print("File is : ",File)
else:
print("Invalid Path")
def main():
print("Marvellous Infosystems by Sidheshwar Jawale")
print("Application Name : "+argv[0])
if(len(argv)!=2):
print("ERROR : INSUFFICIENT ARGUMENTS")
exit()
if(argv[1]=='-u') or (argv[1] == '-U'):
print("USAGE : ApplicationName AbsolutePath_of_Directory Extension")
exit()
if(argv[1] == "-h" ) or (argv[1] == '-H'):
print("HELP :The script is used to traverse specific directory and display all the files ")
exit()
try:
DirectoryTraveler(argv[1])
except ValueError:
print("Error : Invalid Datatype of input")
except Exception :
print("Error : invalid input")
if __name__ == '__main__':
main()