Shane Duffy

Removing all those .svn files

Posted on: February 20, 2008

Im working on a project now and using subversion a lot for the project. One of the things that has been annoying me in the last while is sometimes I want to move code into another svn repository while working on it, and really the only way to do it is to remove all the .svn directories check out the top level empty directory of the repository I want to place the code into and then do svn add *

The only problem been that removing all the .svn files can be a real pain on large projects.

find . -type d -name ‘.svn’ -print0 | xargs –0 rm -rdf

Is a very handy command that I now use all the time. What this does is find all the .svn directories and removes everything below them, leaving me free to add the code back into another subversion repository.

Update: This is also very handy way of reducing the transfer size if using SCP to move your code between servers. As when working on SVN subversions files the .SVN directories can double the size of your code on disk as they store copies of the files in the .svn folders for later comparison

Advertisements

7 Responses to "Removing all those .svn files"

TortoiseSVN has an Export utility that lets you push a folder from your working directory to a non-revision conrolled directory. It’s very handy. It turns out that this is just a GUI over the SVN command line task. You should be able to also use the following:

svn export PATH1 PATH2

The export command is handy sometimes but not always what is required at the time. The method above is useful in certain cases for me.

good but doen’t work

It should be ‘ (single quote) instead of ` (acute)

find . -type d -name ‘.svn’ -print0 | xargs -0 rm -rdf

Did’nt work for me neither, then I removed the “-0” right after the “xargs” and baaaaaaaam…. snv killed silently… 😉

hi,

for some reason the script above did not work for me. I am a mac/terminal noob so probly some error on my part. This script seemed to do the trick:

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

This command does not work with a copy and paste because of the formatting of the quote (‘) characters. Change those to regular quotes and this will work.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Subscribe to this blog now!

Top Clicks

  • None
February 2008
M T W T F S S
« Oct   Apr »
 123
45678910
11121314151617
18192021222324
2526272829  
%d bloggers like this: