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 清源游民 阅读(961) 评论(0)  编辑 收藏 引用 所属分类: Python

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2006年11月>
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

留言簿(35)

随笔分类(78)

随笔档案(74)

文章档案(5)

搜索

  •  

最新评论

阅读排行榜

评论排行榜