-
Notifications
You must be signed in to change notification settings - Fork 51
/
ClenProject.py
32 lines (25 loc) · 1.01 KB
/
ClenProject.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
import os
import os.path
import shutil
def del_spec_file(Path, Ignore, Suffix):
if (Path[len(Path) - 1] == "\\" and Path[len(Path) - 2] == "\\") or (Path[len(Path) - 1] == "/"):
pass
else:
Path = Path + "/"
for File in os.listdir(Path):
if os.path.isdir(Path + File):
if File == "Debug" or File == "Release" or File == "ipch" or File == "x64":
shutil.rmtree(Path + File)
else:
del_spec_file(Path + File, Ignore, Suffix)
elif os.path.isfile(Path + File):
FileSuffix = os.path.splitext(Path + File)[1]
if File in Ignore:
pass
elif FileSuffix in Suffix:
print("删除文件%s"%(Path + File))
os.remove(Path + File)
if __name__ == "__main__":
Suffix = [".idb", ".pdb", ".pch", ".res", ".ilk", ".exe", ".sdf", ".ipch", ".log", ".db", ".obj", ".tlog", ".lastbuildstate"]
Ignore = ["AheadLib.exe","winmine.exe"]
del_spec_file("./", Ignore, Suffix)