Created
October 24, 2025 04:17
-
-
Save ryanmoralesaz/ca6d5d5440c57454bcbb4df788daca06 to your computer and use it in GitHub Desktop.
Clean all dev stuff before backing up to gDrive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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