I can delete files with specific extensions in multiple folders with this:
Get-childitem * -include *.scc -recurse | remove-item
But I also need to delete folders with a specific name - in particular those that subversion creates (".svn" or "_svn") when you pull down files from a subversion repo.
This one should do it:
get-childitem -Include .svn -Recurse -force | Remove-Item -Force -Recurse
Other version:
$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
}
}