有时复制某个版本库的时候会有一些.svn的文件夹很讨厌有的时候还很暂空间,怎么办?
Python实现方法:
#coding:utf-8 #删除SVN相关的目录 import urllib2 import urllib import os import shutil homedir = os.getcwd() def walk_dir(homedir,topdown=True): for root, dirs, files in os.walk(homedir, topdown): #for name in files: #if name=='.svn': #print(os.path.join(name)) #os.remove(os.path.join(name)) for name in dirs: if name=='.svn': print('Delete '+os.path.join(root,name)) shutil.rmtree(os.path.join(root,name),ignore_errors=False) walk_dir(homedir)
或者用如下批处理方式
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN] @="Delete SVN Folders" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command] @="cmd.exe /c \"TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r \"%1\" %%f IN (.svn) DO RD /s /q \"%%f\" \""