Created
July 1, 2019 12:31
-
-
Save Expost/2a271346ec71857dd5447e15bdf91a48 to your computer and use it in GitHub Desktop.
清理vs工程临时生成的大文件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
import shutil | |
def remove(): | |
now_list=os.listdir(os.getcwd()) | |
for i in now_list: | |
if os.path.isdir(i) and (i=="Debug" or i=="Release" or i=="ipch"): | |
try: | |
shutil.rmtree(i) | |
print "remove "+ os.getcwd() + "/" + i + " ok" | |
except: | |
print "error with delete dir "+i | |
if os.path.isdir(i): | |
os.chdir(i) | |
remove() | |
name=os.path.splitext(i)[1] | |
if name==".sdf" or name==".ncb" or name==".opt" or (name == ".db" and ".VC." in i): | |
try: | |
os.remove(i) | |
print "remove "+ os.getcwd() + "/" + i + " ok" | |
except: | |
print "delete",i,"error" | |
os.chdir("..") | |
remove() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment