Tuesday, November 27, 2012

Quick Tip: Use rsync to recursively remove .svn folders from a directory [Field Notes]


I have a directory structure that contains Subversion metadata folders (folders named ".svn").

I would like to remove those folders but "svn export" won't work.


Rsync to the rescue. Let's say the folder containing .svn folder structures is named "problemfolder". Do the following:

  • In the same directory as the problem folder, create a "clean" folder to output the contents of problemfolder to eventually.
    • "mkdir problemfolder_clean"
  • Run rsync, excluding .svn folders and their contents, to copy the problem directory to the clean directory.
    • rsync -avr --exclude='.svn*' /path/to/problemfolder/ path/to/problemfolder_clean
At this point, the contents of "problemfolder" (minus the .svn folders) will be in the clean folder you created.

No comments:

Post a Comment

Keep it classy, folks.