Skip to content

Instantly share code, notes, and snippets.

@shashank-shekhar
Created February 27, 2024 17:36
Show Gist options
  • Save shashank-shekhar/6142c287d4c5a07c86a2705b602e0389 to your computer and use it in GitHub Desktop.
Save shashank-shekhar/6142c287d4c5a07c86a2705b602e0389 to your computer and use it in GitHub Desktop.
Visual Studio real clean
$targetFolders = @('bin', 'obj', 'packages')
$startPath = "."
# Recursively get all directories that match the target folder names, case-sensitively.
Get-ChildItem -Path $startPath -Directory -Recurse | Where-Object {
$dirName = $_.Name
$targetFolders.Contains($dirName)
} | ForEach-Object {
Write-Host "Deleting $($_.FullName)"
Remove-Item $_.FullName -Recurse -Force
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment