« Beta testers needed for Webmail | Main | 8 reasons to like CFML's syntax over PHP's »

Removing ".svn" folders from zip archives

I use Subversion for all of my projects. While it's a life-saver for keeping records of all changes to your source code, it can be more than a little annoying to deal with the ubiquitous ".svn" folders that get put into every directory of your project. If you want to create a zip archive to publish your project, you don't want to publish those .svn folders along with it-- but up until now I haven't known of any other way to get rid of them other than to go into the zip file and delete the unwanted folders one by one. But today I found out that there's a better way (at least on Windows) by creating a new registry entry.

From John Galloway's blog:

[This] REG file adds "Delete SVN Folders" to the context menu for folders. When you select it, it removes all folders named .svn inside the folder and it's children (it does nothing if the project's not under Subversion source control.

John doesn't tell you how to get the new registry entry imported into your own registry, but I will: just copy the lines from his blog and save them in a text file with a ".reg" extension. Then open RegEdit, choose File -> Import..., and then import the file.

Comments (8)

Similar oneliner for unix/mac, this deletes all .svn subfolders in current folder:

rm -rf `find . -type d -name .svn`

If you use Eclipse, you can export a project into an archive file and it'll magically take care of stripping .svn folders and such. Just right click on the folder/project and select 'Export...'.

To publish your project without the svn folders, you can use the SVN Export function to export your project into a new folder and then zip that one.
My 2 cents :)

You can export your branch using your svn client and it will save a copy without all the .svn folders

I use TortoiseSVN. and I can simply right click on my folder and say export, select my output folder and done.

Tom, I suggest using svns built in component for exporting your project. The export creates a clean copy without the svn dir.

svn export

Additionally, the folder is a hidden folder. If you do not show hidden folders, then the folder disappears.

What about just exporting out of the repository? That will pull everything without the .svn folders.

on *nix try this:

tar jcvf project-v.v-svn.tar.bz2 --exclude=*.svn project-folder-name

If you're using zip under Linux, using the -x or "exclude" option is helpful. For example:

zip -9r RelDeployment/RelSource.zip Rel3DBrowser Rel3Shared Rel3Client Rel3Server Rel3Test Rel3Test -x@RelDeployment/exclude.lst

Where exclude.lst contains:

*.settings
*.project
*/*.svn/*
*.class
*.jdb
*.id
*.lck
*.jar

Post a comment


Type the characters you see in the picture above.