Tip in cleaning *SVN folders in PowerShell…

I would say that cleaning these left over *.svn folders can be a pain if you have then in lots of subfolders.  When I realized using PowerShell, it can be very easy to cleanup.  As you know, these folders are hidden and will be propagated to other folders.  So, here’s a one liner that can get rid of these folders:

dir . -include *.svn -Recurse -force | Del -Recurse -force

Simple enough!  The first half of the line is a “Dir”, the alias for “Get-ChildItem”, which will include all the *.svn objects repeatedly under the current folder and forcing to look for hidden ones.

dir . -include *.svn -Recurse –force

Now, the other half, when follow by the “|” pipe symbol, this will pass all the objects collected from the first command and pass it to the next command.  In this case “Del”, the alias for “Remove-Item”, will get rid of all the objects found.  You must have both parameters: “ –Recurse” and “ –Force” in order to work.

Del -Recurse -force

Put it together and there’s no registry hacking, or building a batch file. 

Just plain and simple PowerShell!

%d bloggers like this: