Remove SVN folders from projects in Windows

This is a huge time-saver — big thanks to Hacktrix.com for this one!

I keep version-controlled directories of code snippets, plugins, components, classes, etc.  Problem is that when I go to paste in some of these snippets into projects (especially the more complex ones with deep folder structures), those SVN directories get copied over as well which can create all kinds of issues with the SVN repos on our SVN server.  Since I still work primarily from a PC, I wasn’t sure how to create a simple way to remove these directories.

Hacktrix.com has a great 2-step tutorial about adding a ‘delete SVN directories’ link to your right-click context menu in Windows.  They also have instructions for doing the same from OSX, but that was a bit less magical since it’s already easy enough to do that from the command line.

First, create a file with a .reg extension (cleanSVN.reg per the Hacktrix tutorial).  Paste in the following:

1
2
3
4
5
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 _svn) DO RD /s /q \"%%f\" \""

Double-click the saved cleanSVN.reg file, and now ‘delete SVN folders’ will appear as a context menu item!  So now whenever I paste a plugin directory into a new project, I can just right-click and remove the existing SVN directories.  No more commit errors, no more accidental over-writing!  Hacktrix seems to be a pretty good resource — check them out!

 

Leave a Reply