# Delete all "bin" and "obj" folders recursively from the current directory Get-ChildItem -Path . -Directory -Recurse -Force | Where-Object { $_.Name -in @('bin','obj') } | ForEach-Object { Write-Host "Deleting: $($_.FullName)" Remove-Item -LiteralPath $_.FullName -Recurse -Force -ErrorAction SilentlyContinue }