Skip to content

Instantly share code, notes, and snippets.

@captainill
Created April 16, 2011 21:41
Show Gist options
  • Save captainill/923528 to your computer and use it in GitHub Desktop.
Save captainill/923528 to your computer and use it in GitHub Desktop.
removes all files in a directory named .svn
http://codesnippets.joyent.com/posts/show/104
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
The other way is to do:
find . -name .svn -exec 'rm -rf {}\;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment