Sometimes its necessary to delete all the .svn folders from your subversion working copy.

Here is a simple way to do it on Linux:

rm -rf `find . -name .svn`

That might not work if you have hundreds or thousands of folders, as it might be too many arguments for the rm command. I still like it because its simple. But a more robust way would be:

find . -name .svn -prune -exec rm -rf {} \;

This calls rm on each file separately.

I haven’t tried the following, but on Windows you may be able to:

Create a cleanSVN.cmd file in the root containing these lines:

for /f “tokens=* delims=” %%i in (’dir /s /b /a:d *svn’) do (
rd /s /q “%%i”

You could also try browsing to the files in Windows Exporer and then:
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.

The Windows tips came from Axel’s blog at


  1. Jake Churchill says:

    You make my head hurt

  2. Rob Wilkerson says:

    I do it slightly differently (very, very slightly) on Mac/Linux and wrote a simple registry entry to allow this to be done from the context menu on Windows. In case anyone’s interested:

  3. Steve says:

    Just curious – couldn’t you just do an SVN Export and then replace the original folder with the exported copy? The exported copy doesn’t have any of the .svn stuff in it.

  4. Rob Wilkerson says:


    Sure, you could do that, but it seems like a lot more work than right clicking on a parent folder and selecting an option from a context menu. And what if you have changes in your working copy from what’s in the repository?

  5. Ryan Stille says:

    @Steve, sometimes you can do an export, but sometimes you can’t. In my case I was working with files that had come from a backup of a working copy. The files in the repository were NOT what I needed, I needed the files from the backup of the working copy.

  6. Steve says:

    @Rob – I use TortoiseSVN, so for me it is a right-click, context menu op.

    @Rob,@Ryan – you can direct svn export to pull from the repo or your current working copy. I’ve only ever used it against my current working copy (so I learned something here!)

  7. Rob Wilkerson says:


    I’d argue that it’s a delete-existing-right-click op, but that may just be splitting hairs. 🙂

    You can export from your own working copy or _to_ it? I know the latter, of course, and the problem is that you may be exporting from a repository to a working directory that has updated code. That was my concern. Nonetheless, it’s a 6-of-one-half-dozen-of-the-other thing. To each his own.

  8. sandrar says:

    Hi! I was surfing and found your blog post… nice! I love your blog.  🙂 Cheers! Sandra. R.

  9. Piotr says:

    find -name ".svn" | xargs rm -fr