Wednesday, January 20, 2010

Delete SVN subdirectories (and some others)

Every now and then one would need to add files to Subversion “en mass”. Obviously there are a lot of file types you wouldn't want in your repository. Usual undesirables are BIN and OBJ folders - the are inconvenient to have, and quite often – orphan .SVN remnants which will effectively screw up your new subscription. I struggled with these task long enough and today smart person who reads something besides Science Fiction prepared a script for me:

for /f “tokens=* delims=” %%i in (’dir /s /b /a:d *svn’) do (
rd /s /q “%%i”)

This is to be packed as a KillSVN.cmd file and executed from the root of the folder which contains your solution (not C:\ root, unless you plan to get rid of all your Suvbersion subscriptions!)

it is pretty easy to conclude that deleting BIN and OBJ folders will follow the same patter (this script I wrote myself!):

for /f “tokens=* delims=” %%i in (’dir /s /b /a:d bin’) do (
rd /s /q “%%i”)
for /f “tokens=* delims=” %%i in (’dir /s /b /a:d obj’) do (
rd /s /q “%%i”)


© 2008-2013 Michael Goldobin. All rights reserved