Skip to content

Instantly share code, notes, and snippets.

@kickbase
Created August 2, 2026 02:14
Show Gist options
  • Select an option

  • Save kickbase/4820c73e2fa2245444cc09027ee4ee65 to your computer and use it in GitHub Desktop.

Select an option

Save kickbase/4820c73e2fa2245444cc09027ee4ee65 to your computer and use it in GitHub Desktop.
[Houdini] Remove all "backup" folders under RootPath
# Remove all "backup" folders under RootPath (ASCII only - no encoding issues)
$RootPath = $PSScriptRoot
try {
if (-not (Test-Path -Path $RootPath -PathType Container)) {
Write-Host "Error: Path not found. [$RootPath]" -ForegroundColor Red
exit 1
}
$backups = @(Get-ChildItem -Path $RootPath -Recurse -Directory -Filter "backup" -ErrorAction SilentlyContinue)
if ($backups.Count -eq 0) {
Write-Host "[$RootPath] No backup folder(s) found." -ForegroundColor Yellow
} else {
$backups | Remove-Item -Recurse -Force -ErrorAction Stop
Write-Host "[$RootPath] Removed $($backups.Count) backup folder(s)." -ForegroundColor Green
}
} catch {
Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment