Search This Blog

Wednesday, April 9, 2008

Use PowerShell to remove a directory from Subversion

Sometimes through an oversight on my part or some oddity of Subversion I need to completely remove a directory from source control so I can get the project directory working, building correctly, and then re-enter it into Subversion as new.

The quick answer is to get rid of all the ".svn" directories in each subdirectory of the project.

The easiest way to do this with PowerShell is to have it recursively locate and then delete the directories.

The one-liner:

gci -recurse -include .svn -force | remove-item -recurse -force

Works like a charm.