Recursively remove .svn files
December 16th, 2005
Here’s a quick shell script to recursively remove all the the .svn files starting in the current directory and working down.
find . -type f -name "*.svn" -exec rm '{}' \; -print
Change .svn to look for different types.




September 7th, 2007 at 12:39 am
This creates a “Run Shell Script” that never goes away in my title bar…
Are you sure this is doesn’t end up looping?
September 18th, 2007 at 1:45 pm
The code above will not work.. Error..
warning: the -d option is deprecated; please use -depth instead, because the latter is a POSIX-compliant feature.
This one works..
find . -type f -name “*.svn” -exec rm ‘{}’ \; -print
December 11th, 2007 at 10:16 am
Mike - not sure how you’ve run the script but it’s always been fine for me. Have you any other details.
Hardwarerocks - Thanks for the info, the man page for find on my install (OS X Tiger) doesn’t mention that -d is deprectated. However I’ve changed the post accordingly.
February 21st, 2008 at 10:48 am
The .svn ‘files’ in question are folders which contain the subversion meta-data, including the pristine copies of the checked-out files of your working tree; deleting them means the tree can’t be used as a subversion working tree.
I’m puzzled that you would want to treat an svn working tree this way, unless you specifically want a checked-out copy of the repository without the .svn folders. That’s what ’svn export’ is for.
February 23rd, 2008 at 2:47 pm
The semicolon afer .svn is missing.
- Akshay
September 28th, 2008 at 2:35 pm
@ David
I understand where you’re coming from and if you use subversion correctly there should never be a need to remove the hidden svn files. However, from time to time, I do find that it’s necessary - generally when someone has mistakenly duplicated directories using the Finder in OSX.