Removing all .svn Folders Recursively with find

Advertisement

Advertisement

find . -name ".svn" -exec rm -rf {} \;

The first part is the find, being called on the current working directory, designated by the single period. The -name flag specifies the file/folder name to search for. The -exec flag specifies that we want to run a command instead of having them listed. In this case we are calling the remove (recursive/force) on the files we found. {} in this case translates into the name of the found file. The semicolon is used to end the line, and the slash is just an escape character so it doesn't go to the shell.

You can use SVN export to create a clean version, but sometimes that isn't what you want, because a standard export will not include any unversioned files. There are occasions when you simply want to delete all the .svn folders recursively. That is one of the drawbacks of SVN versus Git. I would prefer having a single hidden folder in the root, like Git.

Advertisement

Advertisement