Friday, December 11, 2009

Cleaning a Tree of .svn Directories

Subversion has an export command that will check a project out of a repository without creating the typical .svn directories used by the local Subversion command to keep track of state. Sometimes, however, it is necessary to strip these directories away. While dabbling in Linux and Mac OS X for several years, I am still a relative noob when it comes to the Unix command line commands.
This command will delete all the .svn directories in the current directory and below. It is a bit more complicated than I would of expected because it supports directories with spaces in their name.
find . -type d -name .svn -print0 | xargs -0 rm -fr