SVN Cleanup Crew

I posted a terminal command about 7 months ago about cleaning up SVN working directories. Unbeknownst to me, wordpress chewed up the code and spit out a useless shell of the command’s former self.

Here it is again, in all its glory:

find -d "your/working/directory" -name ".svn" -exec rm -r '{}' ; -print

I needed it this time, because the working directory of a current top secret web project suddenly became orphaned, its repository suddenly inaccessible.

In any case, if you want more explanation on how this command works, see the original post (now edited).

Cleaning Up After SVN

If you’re using SVN for keeping your source safe for web apps, you may notice uploading the working folder also uploads all those hidden .svn folders. Not ideal.

Here’s the shell command to delete all those .svn files from your working directory:

find -d "your/working/directory" -name ".svn" -exec rm -r '{}' ; -print

The -d flag (-depth) means the find command will “process each directory’s contents before the directory itself” so the rm (delete) command won’t complain it can’t find a file in the structure it just deleted.

(I am not responsible if this screws up your project, I assume if you’re a developer and you’re using SVN you should know what you’re doing. However, just in case you don’t, once you run this command you won’t be able to update your working copy, nor commit or anything else, so… [insert cautionary advice here])