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

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
原文地址:https://www.cnblogs.com/lexus/p/2854248.html