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”
Sorry, comments are closed for this article.


June 16th, 2007 at 03:56 PM
You might be interested in find’s -exec option. :)
find $1 -name .svn -exec rm -fr {} \;
June 16th, 2007 at 03:57 PM
(Of course, if you just need a .svn-less checkout of a repository, try `svn export` instead.)
June 16th, 2007 at 08:30 PM
Shot: cool, didn’t know about the -exec option, thanks!