Welcome to SpellCoder Sign in | Join | Help

One Shell Command to delete all svn hidden folders

If you are using Subversion source control, you will be familiar with the .svn folders that SVN adds to any folder under the source control, these folders are used to keep track of the current state of the folder, but sometimes, I want to copy my code and get rid of these folders, and instead of doing this manually which becomes a headache if you have a very deep hierarchy of folders, this is a Shell Script comes to the rescue

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN]
@="Delete SVN Folders"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command]
@="cmd.exe /c \"TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r \"%1\" %%f IN (.svn) DO RD /s /q \"%%f\" \""

Just copy the previous code and paste it in a text file and raname it to [anything].reg, and then double click on it, and install it

This will add to your context menu an item called  "Delete SVN Folders" when you right click on it a command window an ugly command window will popup and in 3 sec you will be free of all the annoying .svn folders.

If you prefer to Export the code, it is ok, but if you don't keep your *.dll or *.exe or any temp folder on the server repository, so the Export will not export any of them, because they are on your local machine, so the better practice is to make another copy of the code, and apply this Shell Command on it, and voila.

Thanks to Jon Galloway for this tip

kick it on DotNetKicks.com
Published Saturday, September 08, 2007 7:08 PM by Mohammed Hossam
Filed Under:

Comments

# re: One Shell Command to delete all svn hidden folders

Saturday, September 08, 2007 10:01 PM by SimoneB
Or just use TortoiseSVN and click the Export command which does the same thing, except that it copies the files to another location.

# re: One Shell Command to delete all svn hidden folders

Sunday, September 09, 2007 4:53 AM by Mohammed Hossam
@SimoneB
Export will only export the files in the server, so if you have compiled your application, and you want to deploy it, if you exported this folder, you will not get the compiled files (*.dll, *.exe) so you have either to copy them from your folder to the exported one, or rebuild the new exported folder...
but if you used the above shell command, all what you need to is to copy your folder in a separate place and apply the shell command, so you get a clean folder for deployment

# re: One Shell Command to delete all svn hidden folders

Sunday, September 09, 2007 6:09 AM by Korayem
Sweet ya Hossam. Thanks for sharing.

The same registry trick can be modified to do other cmd-line tricks.

# re: One Shell Command to delete all svn hidden folders

Sunday, September 09, 2007 10:39 AM by amir magdy(bo2bo2)
yabn el say3a

# re: One Shell Command to delete all svn hidden folders

Sunday, September 09, 2007 12:20 PM by Michael Trausch
Why not just have an auto-build script that you run that would export the trunk or a branch, and then build and package it up?  That is possible on Windows systems, isn't it?

# re: One Shell Command to delete all svn hidden folders

Sunday, September 09, 2007 1:34 PM by Mohammed Hossam
@Michael Trausch
I think it is possible, but somehow tricky, you have to call something like MSBuild and give it all the *.sln files under the folder so it builds it for you.

# re: One Shell Command to delete all svn hidden folders

Wednesday, October 10, 2007 8:59 AM by Simon Howard
This is what svn export is for.

# re: One Shell Command to delete all svn hidden folders

Wednesday, October 10, 2007 12:10 PM by Mohammed Hossam
@Simon
Please read carefully the post and the comments
Anonymous comments are disabled