[SVN] Recursively delete .svn folders
Subversion gives you a nice “export” command which will export you a clean copy of your project. However, sometimes you will find yourself in front of a deep structure of code and folders which was provided by someone who just zipped up their working copy with all the .svn folders included
.
Removing these folders is easy on unix systems, by doing something like this:
rm -rf `find . -type d -name .svn`
However, this elegant solution is not possible on Windows. So, how do you do it?
Make a litte batch file with the following line and execute it.
FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q "%%G"
Thank you! Saved me alot of effort
Comment by Simon Cruise | 06.28.2008 | 11:43 am
Thanks a lot. I screwed up and had to reimport my project in a new repository. This helped terrifically!
Comment by Dennis Decoene | 08.5.2008 | 12:45 pm
very nice tip to DELETE .SVN FOLDERS in WINDOWS
Comment by Sameer | 09.12.2008 | 8:46 pm
[...] which are created by tortoise svn to keep track of the repository state on the client. I found this site which provided an elegant way which precisely meets my [...]
Pingback by ASpeak » Delete .svn folders recursively | 12.3.2008 | 10:50 am
TERRIFIC!!!! THANKS
Comment by DHIRAJ | 01.5.2009 | 9:15 am
worked great. Thanks.
Comment by chad caldwell | 02.13.2009 | 8:34 pm
thanks
for those who want to run it from Command line directly… use
FOR /F “tokens=*” %G IN (‘DIR /B /AD /S *.svn*’) DO RMDIR /S /Q “%G”
replace with your SVN working dir
like mine…
FOR /F “tokens=*” %G IN (‘DIR /B /AD /S c:\svn_repository\*.svn*’) DO RMDIR /S /Q “%G”
Comment by Ajai | 03.26.2009 | 1:57 am
sorry guys… i have to repost my comment bcz of the stupid formatting
for those who want to run it from Command line directly… use
FOR /F “tokens=*” %G IN (’DIR /B /AD /S [YOURWOKRINGDIR]*.svn*’) DO RMDIR /S /Q “%G”
replace [YOURWOKRINGDIR] with your SVN working dir
like mine…
FOR /F “tokens=*” %G IN (’DIR /B /AD /S c:\svn_repository\*.svn*’) DO RMDIR /S /Q “%G”
Comment by Ajai | 03.26.2009 | 1:59 am
[...] what would happen if you mixed in .svn folders from a different branch?). The google helped me find this cmd.exe one-liner, and I’m simply reposting it here for [...]
Pingback by Cleanup/delete all .svn folders « ben tsai | 06.25.2009 | 2:54 pm
Thank you! Works great.
Comment by Cimi | 11.10.2009 | 11:42 pm
Thanks, worked for me!!!
Comment by Timi | 12.18.2009 | 7:53 pm
thanks for this tip
mine uses a directory name with spaces see below
FOR /F “tokens=*” %G IN (‘DIR /B /AD /S “D:\My Documens\urkurk 1\*.svn*”‘) DO RMDIR /S /Q “%G”
Comment by urkurk | 12.23.2009 | 6:40 am
amazing stuff thanx
rH3uYcBX
Comment by SantaBlue | 12.29.2009 | 7:27 pm