浙江省高等学校教师教育理论培训

微信搜索“毛凌志岗前心得”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

find . -name ".svn*" -print0|xargs -0 rm -rvf

CodeSnippets: Recursively remove all .svn directories [shell] [svn] [bash]

Recursively remove all .svn directories (See related posts)

find . -name .svn -print0 | xargs -0 rm -rf


Update: Thankyou iburrell

Comments on this post

iburrell posts on Aug 08, 2005 at 02:33
That isn't the best way to do it. It will break if you have lots of .svn directories. Then the command line will be too long and you will get 'argument list too long'. Recent bash have enormous buffers so this is less of a problem. xargs solves this problem.

The other problem is any file with spaces in the name will cause bash to treat it as two arguments. Which could give an error or could delete the wrong file. find -print0 and xargs -0 solve this problem.

find . -name .svn -print0 | xargs -0 rm -rf
posted on 2013-01-10 10:51  lexus  阅读(250)  评论(0编辑  收藏  举报