How To Delete .svn Folders From Your Project (on Windows, Linux and Mac)

I am currently working on developing a WordPress plugin, and I use svn for version control. If you have ever used subversion to manage your projects, then you probably already know that there are many (hidden) .svn folders in the checked out project. These folders are created by subversion clients (like TortoiseSVN) to store information about the project’s local state.

The .svn folders are important for the subversion clients but it gets really annoying when sharing the source with someone or uploading it on web. These folders create unnecessary bloat. Its also very difficult to delete all the .svn folders one by one since there are too many of them. Here’s the procedure to delete all .svn folders automatically on Windows, Linux and Mac.

Delete All .svn Folders From Your Project on Windows XP, Vista and 7

1. Create a file cleanSVN.reg with the following registry commands,

Windows Registry Editor Version 5.00
@="Delete SVN Folders"
@="cmd.exe /c "TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r "%1" %%f IN (.svn _svn) DO RD /s /q "%%f" ""

2. Double click on cleanSVN.reg to run it.

This will add a new option, Delete SVN Folders, in your right click context menu.

Just right click on your project folder and select this option to remove all .svn folders instantly. It works perfectly on Windows XP, Vista and Windows 7.

Delete All .svn Folders From Your Project on Linux and Mac

If you are on Linux or Mac, then open terminal and go to your project directory. Then use this command to remove all .svn directories.

find . -type d -name .svn -print0 | xargs -0 rm -rf

Please don’t run this command as root. In fact, you should not run any command as root :)

Note 1 – As I mentioned above, .svn folders are used by subversion clients to manage your project. If you delete those folders, the subversion client will forget everything about your project. So, I advise you to make another copy of your working copy at a different location and then clean it.

Note 2 – You can use the svn export command to directly get a clean copy (a copy without .svn folders).

Note 3 – If you use the TortoiseSVN subversion client, then just export to the current working copy location and it will automatically remove the .svn folders and files(ref).

7 thoughts on “How To Delete .svn Folders From Your Project (on Windows, Linux and Mac)”

  1. Hi, I dont now when did you post this article….. but you conmmand (Linux and Mac) has an error, in fact, the your command runs only under Linux…

    skyline testCSVN $ find -type d -name .svn -print0 | xargs -0 rm -rf
    find: illegal option — t
    find: illegal option — y
    find: illegal option — p
    find: illegal option — e
    find: d: No such file or directory

    If you want to use the command under Linux and Mac you need to use it, maybe like this.

    skyline testCSVN $ find . -type d -name .svn -print0 | xargs -0 rm -rf
    skyline testCSVN $

  2. I got the same error on FreeBSD. Your command is missing a dot right after ‘find’

    find . -type d -name .svn -print0 | xargs -0 rm -rf

    If you copy/paste the command from your article and run it, you’ll see…

    Nice article anyway :-)

  3. Thanks for that. I am a mac user. I got trouble for my project. And I need to remove the .svn and their content. However the above command line miss one thing, the mac only allow root user to operate. So that I modify a bit as below other will got permission problem.

    find . -type d -name .svn -print0 | xargs -0 sudo rm -rf

Leave a Comment