Use Terminal to Delete All .svn Folders Recursively

macossvnterminal.app

What command can I type into the Terminal so that I can delete all .svn folders within a folder (and from all subdirectories) but not delete anything else?

Best Answer

cd to/dir/where/you/want/to/start
find . -type d -name '.svn' -print -exec rm -rf {} \;
  • Use find, which does recursion
  • in the current directory .
  • filetype is directory
  • filename is .svn
  • print what matched up to this point (the .svn dirs)
  • exec the command rm -rf (thing found from find). the {} is a placeholder for the entity found
  • the ; tells find that the command for exec is done. Since the shell also has an idea of what ; is, you need to escape it with \ so that the shell doesn't do anything special with it, and just passes to find