Skip to content

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 Comments

  1. Kartik wrote:

    “svn export” would have also worked right?

    Kartik

    Friday, October 3, 2008 at 3:12 am | Permalink
  2. Grant wrote:

    You *can* svn export a working copy!

    Thanks Kartik.

    Friday, October 3, 2008 at 6:37 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*