Rick Hurst Web Developer in Bristol, UK

Menu

unix command to delete the .svn folders

This command will delete all those pesky .svn directories that have been left by subversion:-

find ./ -name ".svn" | xargs rm -Rf
(obviously you will want to keep the .svn folders if you are still using subversion!)

archived comments

Or a slightly safer version:

find . -name “.svn” -print0 | xargs -0 rm -Rf

(those are zeros, not ohs, if your font shows them ambigiously)

This is slightly safer as is used a null byte () as the delimiter between entries, rather than a space. This means that if I happen to have a folder called “foo” and one with spaces in called “foo bar”, you might find a .svn dir present in “foo bar” will cause the whole of the “foo” directory to be deleted.

-Matt

Matt 2006-10-17 15:16:24

Thanks a bunch for this… Looking for an easy way to remove the .svn dirs without having to go to each directory. Saved me some serious time.

Craig 2007-01-09 14:57:16

Thanks a thousand. You too, Matt.

Braden 2007-03-06 22:18:23

I use this to delete temp mac osx files

find . -name “._*” -print0 | xargs -0 rm -Rf

handy to run before uploading a project via ftp.

Tim 2009-02-28 04:53:01

Depending on the situation, you might be able to just use the ‘svn export’ to check out a clean tree?

Tom 2010-03-06 10:54:19