Recursively delete .svn folders on Windows
July 21st, 2005
Subversion offers a nice “export” command which will export a clean copy of your project. This is very useful for distributing source code without the .svn folders which are present in the working copy. However, there are times when you will find yourself in front of a deep hierarchy of code which was provided by someone who just zipped up their working copy with all the .svn folders included.
Removing these folders is easy on *nix systems, by doing something like this:
find . -type d -name ‘.svn’ -print0 | xargs -0 rm -rdf
However, this elegant solution is not possible on Windows. So, how do you do it? You could write a quick script (Python, Ruby, etc) or use Ant to perform the task, but if you’re using Total Commander you can do this very easily in a few quick steps:
- Invoke a search (Alt+F7) from the projects root directory
- Search for .svn
- When the results are displayed, click the “Feed to listbox” button (bottom right)
- In the list that appears select all the folders and delete (Shift-F8)
Tags: Subversion, Total Commander














Thanks
Your tip really helped
Comment by SiriuS — December 8th, 2005 @ 10:51 am
For those of you that do not use Total Commander this trick could be accomplished easily in windows explorer as well.
Right click on the folder and click Search..
Enter .svn as the filename to search for.
Click “More advanced options” and select:
- Search hidden files and folders
- Search subfolders
Press search button and delete the folders you find appropriate.
Oh, and this description is at least valid for windows xp pro.
I personally would do a Google search for Cygwin, install it, and use the unix style “find” mentioned above..
Thanks for a great blog..
-Martin
Comment by Martin Henricson — January 3rd, 2006 @ 3:12 pm
Very useful - thanks for the tip
Comment by Christophe — March 22nd, 2006 @ 1:05 pm
Guys, you have got to be kidding. Just perform a standard windows search using windoze explorer for .svn (be sure to include hidden stuff in the search). Then select them all and delete them…
Comment by Wow — September 25th, 2006 @ 9:57 pm
The easiest way is by creating a .cmd script file at the root directory and execute it. Here is the code for cleanSVN.cmd :
for /f “tokens=* delims=” %%i in (’dir /s /b /a:d *svn’) do (
rd /s /q “%%i”
)
regards,
azizasm (Malaysia)
Comment by azizasm — August 16th, 2007 @ 4:15 pm
When using Total Commander for this you must first set Configuration - Options - Display - Show hidden/system files. I suggest that you add this to your post as many people won’t find it down here… And, BTW, thanks for the post. I’ve been wondering how to do this. And Total Commander has a new customer.
Comment by Douglas McCarroll — September 7th, 2007 @ 6:04 pm
damn msdos really does suck
Comment by kane — September 20th, 2007 @ 8:20 pm
Thanks for the tip! If you can, please fix the *nix script above to include straight quotes instead of fancy quotes. That’d way when others run into your site, they could just simply copy and paste (and not have to debug). Thanks!
Comment by Jason — October 2nd, 2007 @ 3:12 pm
Volvo Receives Awards For Service Components Distribution
The Swedish brand Volvo recently received awards from Carlisle & Company for their excellence in the distribution of their service parts. Volvo Cars North America was given the distinction as having the number one automotive parts distribution network …
Trackback by Distributing Services — February 22nd, 2008 @ 11:12 pm
[…] http://www.broobles.com/blog/posts/36 […]
Pingback by Delete All .svn Files in windows | Axelology — March 11th, 2008 @ 6:45 pm