Home > General > find svn directories and remove them

find svn directories and remove them

find . -name ".svn" -print0 | xargs -0 -n 1024 -r rm -rf

-n prevents rm too many arguments error
-r prevents execution if none found (and prevents error!)

originally from:

http://www.commandlinefu.com/commands/view/902/delete-all-.svn-directories-from-current-path-recursive

Categories: General Tags:
  1. simon
    November 10th, 2009 at 09:55 | #1

    Why make life difficult? Try

    find -name “.svn” -exec rm -rf \{\} \;

  2. November 10th, 2009 at 10:23 | #2

    Simon,

    Sometimes there are too many files for find to execute like that. “xargs” with those parameters will prevent that error from occurring.

    Cheers,

  1. October 20th, 2009 at 14:26 | #1