1
#written by gameogre
2
#清理VC垃圾:
3
import os
4
import fnmatch
5
postfixes=['*.obj','*.pdb','*.manifest','*.idb','*.ilk']
6
def IsObjFile(filename):
7
for aPostfix in postfixes:
8
if (fnmatch.fnmatch(filename,aPostfix)):
9
return True
10
return False
11
for (root,subs,files) in os.walk("."):
12
for aFile in files:
13
if IsObjFile(aFile):
14
os.remove(os.path.join(root,aFile))
15
print os.path.join(root,aFile)
16
print 'mession is over ,press Enter to quit
'
17
quit=raw_input()
18![](http://www.cppblog.com/Images/OutliningIndicators/None.gif)
1
#----------------------------
2
#清理SVN
3
# written by gameogre
4
import os
5
import shutil
6
import fnmatch
7
from stat import *
8
for root,dirs,files in os.walk('.'):
9
for name in dirs:
10
if name=='.svn':
11
os.chmod(os.path.join(root,name),S_IWRITE)
12
for theRoot,theDirs,theFiles in os.walk(os.path.join(root,name)):
13
for aFile in theFiles:
14
os.chmod(os.path.join(theRoot,aFile),S_IWRITE)
15
shutil.rmtree(os.path.join(root,name))
16
print os.path.join(root,name)
17
print "mission is over, press Enter Key quit"
18
exit=raw_input()
19![](http://www.cppblog.com/Images/OutliningIndicators/None.gif)
posted on 2009-04-27 22:02
清源游民 阅读(974)
评论(0) 编辑 收藏 引用 所属分类:
Python