Python删除svn目录的代码
代码如下:
import os,shutil
def RemoveDir(dir):
shutil.rmtree(dir, True)
def HandleDir(root, dir):
if dir == ".svn":
print os.path.join(root, dir)
RemoveDir(os.path.join(root, dir))
def HandleFile(root, file):
pass
def WalkThroughPath(dst_path):
try:
for root, dirs, files in os.walk(dst_path):
for dir in dirs:
HandleDir(root, dir)
for file in files:
HandleFile(root, file)
except WindowsError:
pass
def main():
WalkThroughPath("D:/Src/chromium.r197479")
if __name__ == "__main__":
main()