Skip to content

Instantly share code, notes, and snippets.

@ryanmoralesaz
Created October 24, 2025 04:17
Show Gist options
  • Select an option

  • Save ryanmoralesaz/ca6d5d5440c57454bcbb4df788daca06 to your computer and use it in GitHub Desktop.

Select an option

Save ryanmoralesaz/ca6d5d5440c57454bcbb4df788daca06 to your computer and use it in GitHub Desktop.
Clean all dev stuff before backing up to gDrive
function cleanbackup {
Write-Host "Cleaning up for backup..." -ForegroundColor Yellow
# node_modules
Write-Host "Removing node_modules..." -ForegroundColor Red
Get-ChildItem -Path . -Filter "node_modules" -Recurse -Directory -Force | Remove-Item -Recurse -Force
# .git folders (since code is on GitHub)
Write-Host "Removing .git folders..." -ForegroundColor Red
Get-ChildItem -Path . -Filter ".git" -Recurse -Directory -Force -Hidden | Remove-Item -Recurse -Force
# Build outputs
Write-Host "Removing build folders..." -ForegroundColor Red
'dist', 'build', 'out', '.next', '.nuxt', '.vite' | ForEach-Object {
Get-ChildItem -Path . -Filter $_ -Recurse -Directory -Force | Remove-Item -Recurse -Force
}
# Caches
Write-Host "Removing cache folders..." -ForegroundColor Red
'.cache', '.parcel-cache', 'tmp', '.temp' | ForEach-Object {
Get-ChildItem -Path . -Filter $_ -Recurse -Directory -Force | Remove-Item -Recurse -Force
}
Write-Host "Cleanup complete! Ready for backup." -ForegroundColor Green
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment