How to use Terminal to delete all .svn folders recursively?

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
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s