Created
April 19, 2017 16:17
-
-
Save philpennock/25ec5e31a8709864bce344c8a1123a56 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/sh -eu | |
set -eu | |
clean_here() { | |
find . -type f -execdir sh -c \ | |
'f="{}"; | |
t=$(file -hb "$f"); | |
[ "$t" = "SQLite 3.x database" ] || exit 1; | |
printf "%s/%s\n" "$(pwd)" "$f"; | |
ls -ld 2>/dev/null "$f" "${f}-journal"; | |
sqlite3 "$f" "vacuum full;"; | |
ls -ld 2>/dev/null "$f" "${f}-journal"; | |
echo | |
' \; | |
} | |
[ $# -eq 0 ] && set \ | |
"${HOME:?}/Library/Application Support/Google/Chrome" \ | |
"${HOME:?}/Library/Application Support/Slack" | |
for DIR; do | |
cd "$DIR" | |
clean_here | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment