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)

5 Responses to “unix command to delete the .svn folders”

  1. Matt Says:

    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

  2. Craig Says:

    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.

  3. Braden Says:

    Thanks a thousand. You too, Matt.

  4. Tim Says:

    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.

  5. Tom Says:

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

Leave a Reply