Deleting .svn files on OSX

Go to the terminal, navigate to the folder you want to delete files from and type :

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

This should delete all .svn folders in the current directory and recurse down into sub-folders too. Please be careful with this! 🙂

I also found this handy AppleScript which will toggle hidden files on the mac:
ToggleHiddenFiles [sorry, no longer available]

Thanks to Niqui Merret and Raymond De Vries for helping with this.

14 replies on “Deleting .svn files on OSX”

Why “*.svn”, when the directory is always named just ‘.svn’?

You might want to look at the xargs program as well.

Sometimes when your project is large enough, it’s possible to use find | xargs in a way which overflows the maximum length of a single command line command. For these situations, xargs has a -n argument, which you can use, for example, to call a script which only accepts a single file name as an argument, by using the xargs argument -n 1. If your call to rm is overflowing, a reasonable argument would be -n 25.

With SVN, you can export a directory, or your entire project to another folder. This essentially gives you a copy of your project, without any SVN data attached/hidden.

The xargs command line would be

find . -name .svn -print0 | xargs -0 -n 100 rm -rf

Also, the GNU find command also accepts the parameter “-type d” which only selects directories.

Comments are closed.