删除工程中svn文件的脚本(Ruby版和Python版)
2009-11-06 12:06
441 查看
两种不同的语言,不同的表达!
Python脚本实现.
Ruby的脚本实现
Python脚本实现.
"" " File Name : clean.py File Date : 2009/11/5 14:22:56 Author : DannyLai Purpose : Clean the svn files All svn projects have an hide directory " . svn" The python script purpose is to clean the .svn directory in svn projects. " "" import os import stat SVNPROJECT_DIR = "F://temp//google-gdata" def findSVNDir( path ) : for file in os. listdir( path ) : subpath = os. path. join( path, file ) if os. path. isdir( subpath ) : if file = = ".svn" : print subpath deleteSVNDir( subpath ) else : findSVNDir( subpath ) def deleteSVNDir( path ) : for file in os. listdir( path ) : subpath = os. path. join( path, file ) if os. path. isdir( subpath ) : deleteSVNDir( subpath ) else : os. chmod( subpath, stat. S_IREAD | stat. S_IWRITE ) os. remove( subpath ) os. rmdir( path ) def cleanSVNDir( path ) : findSVNDir( path ) if __name__ = = '__main__' : cleanSVNDir( SVNPROJECT_DIR ) |
= begin File Name : clean. rb File Date : 2009/ 11/ 5 14: 22: 56 Author : DannyLai Purpose : Clean the svn files All svn projects have an hide directory ".svn" The ruby script purpose is to clean the . svn directory in svn projects. = end require "find" require "fileutils" SVNPROJECT_DIR = "F://temp//fluint" def cleanSVNDir( ) Find. find( SVNPROJECT_DIR ) do | path | if File. directory? path and path. include? ".svn" puts path FileUtils. rm_r path end end end cleanSVNDir( ) |
相关文章推荐
- svn 文件批量删除自动提交脚本(python)
- python脚本--循环删除目录下的文件
- [转载]python脚本删除一定时间以外的文件
- python脚本删除指定路径下指定类型的文件
- svn配置脚本 防止删除文件和空注释
- Mac 终端下删除一个工程项目中的所有.svn文件
- 清除SVN属性文件(.svn)的windows脚本[可改为递归删除某个同名文件夹的脚本]
- 删除工程下的所有.SVN文件
- Python脚本批量删除特定后缀名的文件
- 一段删除.svn目录的python脚本
- 使用python脚本批量删除阿里云oss中的mp4文件
- Python小工具--删除svn文件
- Python实现删除当前目录下除当前脚本以外的文件和文件夹实例
- 删除 python 项目中 .pyc 文件的脚本
- 使用Python脚本删除指定文件夹下的指定目录及其文件
- python脚本实现文件的批量移动、复制,以及删除指定后缀
- 使用svn删除Xcode工程中的文件
- Python基础学习:svn导出差异文件脚本
- python:删除.svn文件
- python备份svn服务器文件脚本