Removing .svn folders from subfolders

In older versions on TortoiseSVN, it would create a version folder called .svn in every sub-folder from the root that was being controlled. This caused a lot of those folders and the could grow pretty big.

In more recent versions there is only one .svn folder, in the root of the controlled folder. But those pesky .svn folders are still in all the sub-folders and going through and manually delete them is a pain, to say the least.

After brushing up on my old DOS and Batch file skills, which I have mostly forgotten, I came up with this - the the help of google.com:

for /f %i in ('dir /a:d /s /b .svn') do echo rd /s /q %i

This will only SHOW you what is to be deleted, to make it actually delete the folders, remove the echo:

for /f %i in ('dir /a:d /s /b .svn') do rd /s /q %i

This will now go through each sub-folder and delete the .svn folder. You can put this into a .bat file for reuse.

Update, April 28:

While the statements above work, they fail if there are spaces in the sub folder names. After some research, this is what I found and it seems to work just fine: