1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #!/bin/bash
- WIN_USER="$(wslpath "$(cmd.exe /c "<nul set /p=%UserProfile%" 2>/dev/null)")"
- LOCAL="$WIN_USER/AppData/Local/Temp"
- ROAMING="$WIN_USER/AppData/Roaming"
- DOWNLOADS="$WIN_USER/Downloads/Temporary"
- cd "$LOCAL"
- echo "Deleting SSH agents"
- find ./ssh-* -maxdepth 1 -type d -mtime +1 2>/dev/null | while IFS= read -r dir
- do
- rm -r "$dir"
- done
- echo "Deleting Office temp files"
- find ./TCD* -maxdepth 1 -type d -mtime +5 2>/dev/null | while IFS= read -r dir
- do
- rm -r "$dir"
- done
- echo "Deleting MySQL Workbench files"
- find ./mysql-workbench-* -maxdepth 1 -type d -mtime +1 2>/dev/null | while IFS= read -r dir
- do
- rm -r "$dir"
- done
- echo "Deleting Google Chrome temp files"
- find ./chrome_drag* -maxdepth 1 -type d -mtime +2 2>/dev/null | while IFS= read -r dir
- do
- rm -r "$dir"
- done
- echo "Deleting go-build temp files"
- find ./go-build* -maxdepth 1 -type d -mtime +5 2>/dev/null | while IFS= read -r dir
- do
- rm -r "$dir" 2>/dev/null
- done
- echo "Deleting NodeJS Yarn temp files"
- find ./yarn--* -maxdepth 1 -type d -mtime +2 2>/dev/null | while IFS= read -r dir
- do
- rm -r "$dir"
- done
- echo "Deleting all other *.tmp files"
- find ./*.tmp -maxdepth 1 -mtime +2 -delete 2>/dev/null
- find -regextype posix-extended -regex "^\.\/\{[0-9A-F\-]{36}\}" -mtime +7 -delete 2>/dev/null
- echo "Deleting month-old temporary downloads"
- cd "$DOWNLOADS"
- find ./* -maxdepth 1 -mtime +30 -delete 2>/dev/null
- cd "$ROAMING"
- echo "Deleting VS Code caches older than 30 days"
- find ./Code/Cache/Cache_Data/* -type f -mtime +30 2>/dev/null | while IFS= read -r file
- do
- rm -f "$file"
- done
- find ./Code/CachedData/ -maxdepth 1 -type d -mtime +30 2>/dev/null | while IFS= read -r dir
- do
- rm -rf "$dir"
- done
- echo "Deleting DBeaver files"
- find ./DBeaverData/workspace6/General/Scripts/*.sql -size +1c -atime +7 -delete 2>/dev/null
- cd "$OLDPWD"
|