You are here

SVN: Remove/delete .svn directories recursively

Submitted by Druss on Fri, 2014-07-18 01:22

Earlier today, I wanted to recover some files that I'd added to version control (for safe keeping). However, I did not want to retain the pesky .svn files that plague every directory in the tree (unlike the wonderful git). GOOG directed me to solutions that all rely on Linux tools to do the trick. The following does work admirably:

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

However, this seemed ham-handed. Surely there is a cleaner way of accomplishing this. And there is. You just need to use SVN's export command. At the command-line, this would go something like this:

$ svn export

This, as you can probably tell, exports directly from the repository. To export from the current working copy (and thereby avoid having to download the entire repository once again), the manual recommends:

$ svn export a-wc my-export

If bandwidth is not an issue, then I'd recommend always exporting from the repository.

If you're on Windows and using TortoiseSVN or similar, there are equivalent solutions.