Subversion Directories

June 15th, 2007

Once in a while, I need to remove all .svn directories from a svn repository that I just checkout. So, I go over to Text Drive Snippets and search through the svn code to find the recursive call to do what I need. Well, that is a pain to do each time.

Here’s a quick little bash function that I added to my $HOME/.bash_profile:


rm_svn(){
    find $1 -name .svn -print0 | xargs -0 rm -rf
}

This allows me to recursively remove all .svn directories in whatever directory I pass to it via the command line. e.g. rm_svn . || rm_svn /project

3 Responses to “Subversion Directories”

  1. Shot Says:

    You might be interested in find’s -exec option. :)

    find $1 -name .svn -exec rm -fr {} \;

  2. Shot Says:

    (Of course, if you just need a .svn-less checkout of a repository, try `svn export` instead.)

  3. Robert Says:

    Shot: cool, didn’t know about the -exec option, thanks!

Sorry, comments are closed for this article.