So I was spending a considerable amount of time trying to get Powershell to recursively delete all of my .svn directories. Looking through the help files and on the web provided no examples of how to delete these directories or even any others using the get-childitem command. I was severely dissapointed, I tried passing the entire list of directory objects, but when I got to the last pipe to actually delete the objects there weren't any svn directories. Here is my original attempt:
>> get-childitem -recurse | where {$_.DirectoryName -contains "svn"}
The above did not find any directories, it was really sad, I even tried using -match and -like.
<Updated> I got Powershell to work with help from Jeffrey Snover. I realized that the svn folder was hidden and that is why it was not appearing. Here is the updated command that should work for you in Powershell. Keep in mind that you can pass get-childitem a path to where you want to delete from, otherwise it defaults to all subdirectories from your current position in the stack of folder items.
>> Get-ChildItem -Recurse -force |where {$_.PSIsContainer -AND $_.Name -match "svn"} | foreach ($_) {remove-item -force -recurse $_.fullname}
Here is the command prompt solution:
for /r YOURPATH %f in (.svn) do rd /s /q %f
I want to love powershell, but sometimes tasks are just more complex to perform than in the original command prompt. In addition, the help is really not that great, perhaps after I read the TFM book from Sapien Press I will understand things better. I mean I have read all of the documents that came with Powershell, but there is just a large amount of things to remember without really that many useful examples. Also, the examples that Microsoft has provided in their script library are really limited, all they do is output some information from WMI objects. I would love it if they shared some more complex scripts so that I could learn more advanced techniques with using Powershell.
Here are some useful Powershell resources:
http://channel9.msdn.com/wiki/default.aspx/Channel...
http://www.computerperformance.co.uk/powershell/po...