Remove .svn files recursively

Today I needed to convert a Subversion working copy (aka a checkout) into an export. Recursively blowing away all of the .svn directories in DOS (Windows XP) didn’t seem to be straightforward so I ended up using UNIX find in cygwin. Here is the command:

find . -type d -name '.svn' -exec rm -rf {} \;

The command was provided here, and the following is documentation from the man page.

  • find :: Execute the find command
  • . :: Path in which to start
  • -type d :: File is of type ’d’, a directory.
  • -name ’.svn’ :: The file name on which to match, .svn.
  • -exec rm -rf {} \; :: Execute this command for every file that is found. The string ’{}’ is replaced by the current file name being processed. The semi-colon is escaped by a backslash. While reading the man page, I also found that you probably should enclose the braces in single quote marks.

2 thoughts on “Remove .svn files recursively”

Leave a Reply

Your email address will not be published. Required fields are marked *