How To Clean Subversion Directories
When you checkout a repository from subversion it creates a .svn directory (with subdirectories) for every directory (and subdirectory) checked out. The .svn directory contains information about the repository and files in the directory and allows you to run svn commands without having to authenticate yourself in future. However when you want to package the source code it becomes painful to remove them by hand. You can either use a build tool like ant and exclude the .svn directories or you can use my code to clean the directory of .svn junk.
Download SVNClean here.
Usage:
java SVNClean [list of files or directories]
The code runs on any java supported platform (tested on windows and linux).
Use at your own risk. No warranty, implied or otherwise, is provided.
Filed under Headline News, How To, Java Software, Tech Note, Web |
|
RSS 2.0 |
Trackback this Article
|
Email this Article
You may also like to read |




































June 16th, 2006 at 11:27 am
’svn export’ is your friend.
June 16th, 2006 at 12:50 pm
Or, if you have rsync you can to this…
rsync -C /path/to/source/ /path/to/destThe -C option excludes .svn directories on a copy.
June 18th, 2006 at 12:26 pm
Thanks for the tips.
September 16th, 2006 at 3:17 pm
That java prog didn’t work for me, and I was too lazy to whip up a script. Neither did that rsync script. So, I created local svn repo and used import/export.
% svnadmin create /tmp
% svn import . file:////tmp
% svn export file:////tmp
March 6th, 2007 at 11:07 pm
If you prefer an Ant-based solution to deleting hidden/read-only work directories, the ‘defaultexcludes’ option is your friend.
March 6th, 2007 at 11:19 pm
Hm, that nuked my build.xml target tags, try this version…
<target name=”clean-environment” depends=”clean-gen”
description=”Clean all Eclipse/Subversion environment files and directories”>
<delete includeemptydirs=”true” failonerror=”false”>
<fileset dir=”${basedir}” defaultexcludes=”no”>
<include name=”**/.svn/**” />
<include name=”**/.settings/**” />
<include name=”**/.classpath” />
<include name=”**/.project” />
<include name=”**/.tomcatplugin” />
</fileset>
</delete>
</target>
August 2nd, 2007 at 1:51 pm
This worked fine for me and was exactly what I wanted. I simply wanted to remove all the Subversion artifacts from a directory structure without having to actually have Subversion loaded or creating a bogus Ant target. This did the trick as expected.
Thanks!
April 1st, 2008 at 7:15 am
Change to root directory folder and type:
find . -type d -name .svn -exec rm {} -R \;
Just for linux!