Sitening

Home » Blog

OS X Finder Plugin to Remove .SVN Directories

By Tyler Hall

We use SVN to store all of our source code here at Sitening. And, like most people who use it, you often find yourself in need of cleaning out all the .svn directories that it creates. There’s no easy way to do this without turning to the command line - and that’s not an option for non-programmers.

To fix this problem, I whipped up a small Finder plugin using Automator that adds a new menu when you right-click on a folder. With one click you can remove all the .svn directories inside it. Download the plugin here.

To install, simply unzip the file and drag it into your Library/Workflows/Applications/Finder directory. If that folder doesn’t exist, you’ll need to create it. Now, whenever you right click on a folder, you should see the following menu.

Picture 3.png

I hope this helps all the non-techie SVN users out there.

P.S. - For the geeks in the audience, the command I’m using to remove the .svn folders is

find . -name .svn -print0 | xargs -0 rm -rf

This entry was posted on Tuesday, April 3rd, 2007 at 4:15 pm and is filed under Apple, How To, Productivity. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


7 Responses to “OS X Finder Plugin to Remove .SVN Directories”

  1. Collin Says:

    You don’t need the -print0 or -0 flags; “find . -name .svn | xargs rm -fr” will do the same thing.

  2. Tyler Hall Says:

    Aha. That’s easier.

  3. Evan Wired Says:

    You know that you can always do an svn export and get a clean copy of whatever is in your repository without the subversion metadata, right?

  4. Tyler Hall Says:

    Yep, but this is good for less technical users. Dropping into a terminal window isn’t always an option for everyone. But, you’re right. Exporting would work, too.

  5. Michael Tyson Says:

    Re: Colin - You can avoid the -print0 and -0 flags, but then I’m pretty sure it’ll have trouble with paths including spaces; if one happens to have directory names with spaces, it’ll fail with those directories.

    A better alternative is using find itself to perform the command (note the slash-semicolon):

    find . -name .svn -exec rm -rf {} \;

  6. AndreL Says:

    PAY ATTENTION. I was cheking out the plug-in installation and I clicked the “Remove…” command from my desktop. As a consequence, it has erased all the .svn in ALL the network volumes I had mounted. We have lost hundreds of working copies that now need to be recreated. A note on this would have been appreciated…

    The plugin works like a bomb, very powerful, but very, very dangerous…

  7. Tyler Says:

    Yikes, sorry about that Andre.

    Adding a -x argument to the find command will prevent find from spanning across physical volumes.

Leave a Reply