一段删除.svn目录的python脚本
2014-02-10 15:38
288 查看
代码如下:
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import shutil # call the delete_svn function def delete_svn(root_dir): subdir_list = os.listdir(root_dir) for name in subdir_list: to_delete_name = os.path.join(root_dir, name) if name == '.svn': shutil.rmtree(to_delete_name, ignore_errors=None) print 'deleting the ' + to_delete_name continue if os.path.isdir(to_delete_name): delete_svn(to_delete_name) # check the length of params if len(sys.argv) < 2: print 'Please specify the dir path' sys.exit() # check if the input dir path is valid root_dir = sys.argv[1] if not os.path.exists(root_dir): print 'Pleanse specify an existing path' sys.exit() # check if the input dir path is a directory if not os.path.isdir(root_dir): print 'Please specify an directory path' sys.exit() delete_svn(root_dir)
相关文章推荐
- 删除SVN/CVS目录的bat脚本
- Python脚本删除VC临时文件及Debug目录
- 【python】无聊之作:删除指定目录下的SVN文件
- 删除目录下 .svn的脚本
- 删除文件路径下的.svn目录的脚本
- 使用Python脚本删除指定文件夹下的指定目录及其文件
- 删除SVN/CVS目录的bat脚本
- Python实现删除当前目录下除当前脚本以外的文件和文件夹实例
- svn 文件批量删除自动提交脚本(python)
- 删除.svn的python脚本
- 删除SVN/CVS目录的bat脚本
- Python实现删除当前目录下除当前脚本以外的文件和文件夹实例
- Windows下删除所有SVN目录的脚本
- 删除SVN/CVS目录的bat脚本
- 用Python脚本自动删除VC项目目录下临时文件
- Windows下删除所有SVN目录的脚本
- 用Python脚本自动删除VC项目目录下临时文件
- 【python初学】自动删除目录下空文件夹脚本
- 使用脚本删除svn目录下的.svn文件夹
- python写一段脚本代码自动完成输入(目录下的所有)文件的数据替换(修改数据和替换数据都是输入的)【转】