I shared this script with a coworker yesterday. It doesn’t do much; it recursively deletes .svn folders from a source tree. It comes in handy if you want to share your codebase or you get in a terrible spot with SVN and
you just want to start all over. Just blow away all svn artifacts and use your mulligan.
It’s true. You can nearly get the same result using the SVN export command which copies your source sans the .svn folders to an alternate location. The catch is an export only includes those files/folders which exist under version control. If you want a clean copy of your source – versioned or not – export just might not do.
The contents of the .cmd file include the following:
for /f "tokens=* delims=" %%i in (’dir /s /b /a:d *.svn’) do (
rd /s /q "%%i"
)
Just download and drop the unzipped “SVN Cleanup.cmd” file into the root of the project, execute and away you go.
If you search around enough, I know you can find similar scripts and approaches elsewhere, but I’m still uploading my script for completeness and future reference.
Download SVN Cleanup
January 9th, 2010 at 8:12 am
Shouldn’t it just be ‘.svn’ without the *?
January 9th, 2010 at 11:07 am
if you are living in UNIX land this works:
rm -rf `find . -type d -name .svn`
January 9th, 2010 at 1:24 pm
@Justin - Since the svn folders are all named “.svn” I think we’d have the same net result if the * is included or not. To ensure we only delete the “.svn” directories and no other variation like “donotremovethis.svn” we’re probably better off using your approach.
@David - Thanks for the contribution. The UNIX command is a nice addition to the post.