May I recommend the -whatif the first go
"RichS" <RichS@discussions.microsoft.com> wrote in message
news:C976E20F-9066-445F-AECB-2504B414C479@microsoft.com...
> You could try something like this
>
> $fso = New-Object -com "Scripting.FileSystemObject"
> $folder = $fso.GetFolder("C:\Test\")
>
> foreach ($subfolder in $folder.SubFolders)
> {
> If ($subfolder.Name -like "*.svn")
> {
>
> remove-item $subfolder.Path -Verbose
>
>
> }
>
>
> }
> --
> Richard Siddaway
> Please note that all scripts are supplied "as is" and with no warranty
> Blog: http://richardsiddaway.spaces.live.com/
> PowerShell User Group: http://www.get-psuguk.org.uk
>
>
> "S. A. Gnezdov" wrote:
>
>> I want to replace VBScript with PowerShell implementation. Here is
>> VBScript
>> content:
>>
>> ' Deletes all .svn folders recursively
>> '
>> ' To delete all .svn directories in current directory recursively execute
>> command:
>> ' cscript del-svn-recursively.vbs
>>
>> Set FSO = CreateObject("Scripting.FileSystemObject")
>> ShowSubfolders FSO.GetFolder(".")
>>
>> Sub ShowSubFolders(Folder)
>> For Each eachFolder in Folder.SubFolders
>> ' FSO.DeleteFolder(eachFolder)
>> if eachFolder.Name = ".svn" then
>> WScript.Echo eachFolder.Path
>> FSO.DeleteFolder eachFolder.Path, True
>> else
>> ShowSubFolders eachFolder
>> end if
>> Next
>> End Sub
>>