Shell Command - Remove SVN Folders

The Subversion source control client maintains your local state in hidden folders named .svn inside your project, which can be a problem if you want to copy or share the project directory.  This REG file adds "Delete SVN Folders" to the context menu for folders. When you select it, it removes all folders named .svn inside the folder and it's children (it does nothing if the project's not under Subversion source control.

I'm not going to bother explaining reg file installation here - I figure if you're using SVN, you're good with reg files.

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\" \""

I got the idea from Wyatt Preul's post comparing Powershell and Command Prompt commands to delete SVN directories, so if you'd like to do this manually take a look at his scripts. 

Published Saturday, February 24, 2007 2:30 PM by Jon Galloway
Filed under:

Comments

# re: Shell Command - Remove SVN Folders

Heya Jon,

Another way you can crack this nut is to use the export command:

 http://svnbook.red-bean.com/nightly/en/svn.ref.svn.c.export.html

Cheers,

Matt

Saturday, February 24, 2007 6:58 PM by MattyT

# re: Shell Command - Remove SVN Folders

Thanks, Matt. Looks like they're slightly different - SVN export copies your project to a new folder that's not under SVN control, and the "Remove SVN Folders" command I posted removes SVN control from the current folder.

Monday, February 26, 2007 1:58 PM by Jon Galloway

# re: Shell Command - Remove SVN Folders

Very nice, thanks for sharing.

Tuesday, February 27, 2007 1:24 PM by Scott Schecter

# re: Shell Command - Remove SVN Folders

SVN Export only exports files that are under SVN control. It will not export files set to ignore. This reg entry is a very cool way to clean up a copied SVN folder when you want to share the ignored files, too.

Thx for posting it.

Tuesday, February 27, 2007 2:47 PM by David Parsons

# re: Shell Command - Remove SVN Folders

Good idea, you may want to include _svn for ASP.Net developers. Not familar with cmd so not sure how you would add this myself though.

Wednesday, February 28, 2007 6:03 AM by Damien McGivern

# Terminally Incoherent » Blog Archive » Remove .svn Folders from the Project Directory

Pingback from  Terminally Incoherent  » Blog Archive   » Remove .svn Folders from the Project Directory

# Why SubVersion SVN can be a pain

Pingback from  Why SubVersion SVN can be a pain

Saturday, June 09, 2007 11:11 AM by Why SubVersion SVN can be a pain

# Technical Related Notes » Blog Archive » links for 2007-02-28

Pingback from  Technical Related Notes  » Blog Archive   » links for 2007-02-28

# One Shell Command to delete all svn hidden folders

Remove SVN subfolders

Saturday, September 08, 2007 7:11 PM by Bashmohandes

# re: Shell Command - Remove SVN Folders

to ene genie toi papi..mu

Monday, September 10, 2007 6:16 AM by Ashvin Gunga

# Removing .svn Folders From a Directory Tree

If I had a $1 for every time I've wanted to remove all of the .svn folders from a directory tree

Thursday, September 13, 2007 2:43 PM by Rich Mercer

# Phantom of Ash » ??????SVN??????SHELL??????

Pingback from  Phantom of Ash  » ??????SVN??????SHELL??????

Monday, October 22, 2007 9:07 AM by Phantom of Ash » ??????SVN??????SHELL??????

# re: Shell Command - Remove SVN Folders

so...cool~~~:>

it is a very useful tip.

SVN folders have always bothered me.

i don't worry about that owe to you

thanks~~

Monday, November 26, 2007 4:07 AM by vkimone

# Subversion and TortoiseSVN tips and tricks

Subversion and TortoiseSVN tips and tricks

Tuesday, December 11, 2007 4:33 PM by Bite my bytes

# re: Shell Command - Remove SVN Folders

It doesn't work :(

Thursday, December 13, 2007 10:02 AM by Dime

# EvoTalk » Remove .svn Folder

Pingback from  EvoTalk » Remove .svn Folder

Thursday, December 27, 2007 10:51 AM by EvoTalk » Remove .svn Folder

# re: Shell Command - Remove SVN Folders

Works perfect. Thanks!

Friday, January 25, 2008 5:39 AM by Kras

# re: Shell Command - Remove SVN Folders

It doesn't appear to work for me.

When I select a folder and right click -> DeleteSVN in the shell menu, it prompts me with the "Open With" dialog.

Thursday, January 31, 2008 12:11 PM by Brandon

# re: Shell Command - Remove SVN Folders

Thank you sooooo much. This little entry in the context menu is really handy!

Thursday, February 21, 2008 2:49 PM by Josh

# The Deleting SVN Folders meme

Perhaps I should name 5 other people to modify this script when I'm done. First, it was Wyatt , then

Thursday, March 06, 2008 9:32 AM by British Inside

# re: Shell Command - Remove SVN Folders

quick and dirty update to delete .svn and _svn :D

Thursday, March 06, 2008 9:34 AM by James Shaw

# Mind Gravy » Blog Archive » links for 2008-03-08

Pingback from  Mind Gravy  » Blog Archive   » links for 2008-03-08

Saturday, March 08, 2008 7:24 AM by Mind Gravy » Blog Archive » links for 2008-03-08

# Wildbit » Blog Archive » How to clean .svn folders from your project – Social Networking and Subscriber-based Services.

Pingback from  Wildbit  » Blog Archive   » How to clean .svn folders from your project – Social Networking and Subscriber-based Services.

# re: Shell Command - Remove SVN Folders

i come from china , thx for your code,it resolved my problem

Wednesday, April 02, 2008 2:56 AM by xzqttt

# iotashan’s blog » Blog Archive » Deleting development folders

Pingback from  iotashan’s blog  » Blog Archive   » Deleting development folders

# re: Shell Command - Remove SVN Folders

Doesn't work for me.

Monday, June 02, 2008 1:07 PM by qed

# re: Shell Command - Remove SVN Folders

For the poster asking for help with removal of _svn files, append this to the end of the line in your reg file:

<B>&& FOR /r \"%1\" %%f IN (.svn) DO RD /s /q \"%%f\" \""</B>

Thursday, June 05, 2008 6:30 PM by Chax0

# Remove .svn folder from SubVersion working folder &laquo; .NET Blog

Pingback from  Remove .svn folder from SubVersion working folder &laquo; .NET Blog

# Remove _svn folders with a script?

Remove _svn folders with a script?

Thursday, July 10, 2008 12:25 PM by UZUN.NET

# re: Shell Command - Remove SVN Folders

Thats awesome! Takes 10 seconds to 'install', works right away and solved one of my biggest annoyances with SVN. Great!

Saturday, July 12, 2008 11:01 AM by Dready

Leave a Comment

(required) 
(required) 
(optional)
(required)