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

# ??????SVN??????SHELL?????? | Good good study, day day up

Pingback from  ??????SVN??????SHELL?????? | Good good study, day day up

# Shell Command - Delete SVN Folders | devintelligence.com

Pingback from  Shell Command - Delete SVN Folders | devintelligence.com

Saturday, July 26, 2008 10:13 AM by Shell Command - Delete SVN Folders | devintelligence.com

# re: Shell Command - Remove SVN Folders

Does exactly what it says on the tin, thanks muchly.

Thursday, July 31, 2008 11:31 AM by Keith Lawrence

# re: Shell Command - Remove SVN Folders

Thank you so much, it makes things so much easier when the working copy gets corrupt!

Thursday, August 14, 2008 4:52 AM by Xavier

# re: Shell Command - Remove SVN Folders

You rule, thanks

Tuesday, August 19, 2008 1:08 PM by Misha

# re: Shell Command - Remove SVN Folders

Thankssssssssssss, nice one :-)

Friday, August 29, 2008 2:24 PM by timbo

# re: Shell Command - Remove SVN Folders

Perhaps you don't need this after all. I just noticed this gem in the documentation, haven't tried it myself but I assume it works.

tortoisesvn.net/.../tsvn-dug-export.html

Removing a working copy from version control

Sometimes you have a working copy which you want to convert back to a normal folder without the .svn directories. What you really need is an export-in-place command, that just removes the control directories rather than generating a new clean directory tree.

The answer is surprisingly simple - export the folder to itself! TortoiseSVN detects this special case and asks if you want to make the working copy unversioned. If you answer yes the control directories will be removed and you will have a plain, unversioned directory tree.

Thursday, September 04, 2008 6:20 PM by Kurt Harriger

# re: Shell Command - Remove SVN Folders

#Krug

Your suggestion doesn't works for me, I'm using TortoiseSVN 1.4.8.

Using the Shell command is much easier, coz you just need one click to remove all the svn folder

Thursday, September 11, 2008 4:36 AM by Joe

# re: Shell Command - Remove SVN Folders

Thanks you soo much!

Thursday, October 16, 2008 5:25 AM by Anders Vindberg

# re: Shell Command - Remove SVN Folders

Jon, can you remove or update that link to Wyatt Preul's post?  It goes to a 404 on a blog which I'm 99% sure has succumbed to a spammer.  If you skim the articles you'll see what I mean although it's not very obvious.

Tuesday, October 21, 2008 7:49 AM by Hal Rottenberg

# Removendo bindings do Subversion de um projeto &laquo; Code Samurai

Pingback from  Removendo bindings do Subversion de um projeto &laquo; Code Samurai

# A Day in Paradise &raquo; Deleting .svn files with windows

Pingback from  A Day in Paradise &raquo; Deleting .svn files with windows

Wednesday, October 29, 2008 11:03 AM by A Day in Paradise » Deleting .svn files with windows

# re: Shell Command - Remove SVN Folders

Thanks Jon this is really great.

I tried to modify the command so that it deletes all files except the svn ones.  The reason being I want to replace my project with the latest (unversioned) files, and want SVN to detect the changes.  If I simply overwrite the directory then deleted files (ie those existing in the old version but gone in the new) will go unnoticed.

Unfortunately my Windows Command skills are not up to snuff.  Can anyone help me?

Wednesday, October 29, 2008 1:09 PM by Inquisitive Coder

# re: Shell Command - Remove SVN Folders

This is just what I was looking for, tried it and it works a treat. Definitely a keeper.

-- Lee

Thursday, November 20, 2008 11:12 AM by Englestone

# Delete SVN Folders &laquo; Clive Ciappara With .Net, Vista &amp; iPhone

Pingback from  Delete SVN Folders &laquo; Clive Ciappara With .Net, Vista &amp; iPhone

Wednesday, November 26, 2008 5:18 AM by Delete SVN Folders « Clive Ciappara With .Net, Vista & iPhone

# SVN Verzeichnisse l??schen | LieberLieber Software TeamBlog

Pingback from  SVN Verzeichnisse l??schen | LieberLieber Software TeamBlog

Tuesday, December 02, 2008 9:10 AM by SVN Verzeichnisse l??schen | LieberLieber Software TeamBlog

# Right-Click Goodies

Right-Click Goodies

Saturday, January 10, 2009 10:20 PM by Brownsblogging

# re: Shell Command - Remove SVN Folders

TortoiseSvn has a nice feature to do this, tortoisesvn.net/.../343

Friday, January 16, 2009 10:29 AM by McDon

# Windows?????????.svn???????????????????????????

Pingback from  Windows?????????.svn???????????????????????????

Wednesday, February 18, 2009 8:25 PM by Windows?????????.svn???????????????????????????

# re: Shell Command - Remove SVN Folders

I created some code to delete .svn folders. I thought you might be interested:

wewillrulethegalaxytogether.blogspot.com/.../deleting-svn-folders-for-subversion.html

Monday, March 09, 2009 10:44 AM by Greg Finzer

# Windows下删除.svn文件夹的最简易方法

SVN是我认为目前最方便的版本管理体系。我最早一次接触版本管理是2004年,当时学校BBS的代码要求用CVS管理;第二次亲密接触是在2006年,当时公司的代码使用Eclipse CVS管理;而第一次使...

Wednesday, March 18, 2009 3:25 AM by 永不放弃-Jack wu

# re: Shell Command - Remove SVN Folders

Another way is go to ur project folder then use F3 key for search then go to advance option.. search folder and subfolders for folder named: .svn

Tuesday, March 31, 2009 4:13 AM by Jay Manligas

# re: Shell Command - Remove SVN Folders

Hi,

Getting an error for SVN Service how to resolve this

:  Error 1053: The service did not respond to the start or control request in a timely fashion.

Tuesday, April 14, 2009 12:30 AM by Bhaskar

# re: Shell Command - Remove SVN Folders

Worked great, needed to copy around 4 gigs of SVN downloads and they would never even start, once I cleared all the folders it only took a couple minutes :)

Friday, May 08, 2009 2:19 AM by Rad

# Eliminare le cartelle .svn da un progetto SVN Subversion | alessandrobondi

Pingback from  Eliminare le cartelle .svn da un progetto SVN Subversion | alessandrobondi

# re: Shell Command - Remove SVN Folders

Very handy, thanks. Doing a *.svn search in Windows 7 and deleting was taking far too long (and it uses hidden/readonly for the folders too)

Tuesday, May 19, 2009 3:47 AM by Chris

# re: Shell Command - Remove SVN Folders

Thanks for that, saved my life now.

Friday, June 12, 2009 11:39 AM by sqlclient

# caseydunham.net &raquo; Removing all .svn folders

Pingback from  caseydunham.net &raquo; Removing all .svn folders

Monday, June 15, 2009 9:27 PM by caseydunham.net » Removing all .svn folders

# re: Shell Command - Remove SVN Folders

You saved my life on windows. However on Linux it is even simplier:D

find -type d -name '.svn'

Tuesday, June 30, 2009 10:49 PM by Techi

Leave a Comment

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