Mailing List



NerdyHearn - Blog

<< Back To All Blogs

Recursively removing SVN bindings with PowerShell

Sunday, April 19th, 2009

I was up until 4AM last night because I had a catastrophic server failure on my SVN server. My SVN server had a mirrored raid volume, and one of the disks failed. I replaced the disk and was recovering the mirror when Windows blue-screened and the volume was corrupted completely beyond repair. Never a fun thing, but this is why I am so heavy on the backup process. I had a backup up until the previous night, but had done a bunch of programming during the day yesterday. I decided I would need to migrate the changes with my backup after restoring the repositories.

The bad part of this is that I only had my changes on the local SVN checkout of my repositories, and therefore needed to remove the SVN bindings and copy-over the checkout of my new SVN repositories. If you don't remove the bindings, SVN tends to do some very funky things, which result in a completely useless checkout.

PowerShell definitely came to the rescue for me on this one, I just ran this command, and all of my problems were solved:

Get-ChildItem -Include .svn -Recurse -Force | ForEach-Object { del $_.FullName -Recurse -Force }

This is assuming that your subversion metadata is stored in .svn folders (the default behavior). Older versions of TortoiseSVN may require that you change .svn to _svn. To view how your metadata is stored, go to your SVN checkout, go to the folder options, and select to view hidden and system folders and files.

I am continually loving PowerShell more and more, very impressive, very useful, very nerdy.

PowerShellin' Tom Out.


PowerShell SVN System_Maintenance

Related Blogs

Uninstalling PowerShell V1.0 from Windows Server 2003
Programatically Retrieving an Assembly's PublicKeyToken through a PowerShell CmdLet

Current file path in custom PowerShell Cmdlet


Kevin said on Monday, April 20th, 2009 @ 9:01 AM

There's also SVNcleaner

Add A Comment



Email Address: (not public, used to send notifications on further comments)


Enter the text above, except for the 1st and last character:

NerdyHearn - Latest tech news relating to C#, ASP.NET, SharePoint, PHP, general development, and more. SaveMySerials - Protect yourself from theft, fire, natural disasters and more by recording your serial numbers