1#written by gameogre
2#清理VC垃圾:
3import os
4import fnmatch
5postfixes=['*.obj','*.pdb','*.manifest','*.idb','*.ilk']
6def IsObjFile(filename):
7 for aPostfix in postfixes:
8 if (fnmatch.fnmatch(filename,aPostfix)):
9 return True
10 return False
11for (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)
16print 'mession is over ,press Enter to quit'
17quit=raw_input()
18
1#----------------------------
2#清理SVN
3# written by gameogre
4import os
5import shutil
6import fnmatch
7from stat import *
8for 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)
17print "mission is over, press Enter Key quit"
18exit=raw_input()
19
posted on 2009-04-27 22:02
清源游民 阅读(974)
评论(0) 编辑 收藏 引用 所属分类:
Python