Skip to content

Instantly share code, notes, and snippets.

@panzi
Created October 8, 2014 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panzi/f0a2f4c5afa44484189f to your computer and use it in GitHub Desktop.
Save panzi/f0a2f4c5afa44484189f to your computer and use it in GitHub Desktop.
Find SQLite files and vacuum them. (E.g. to really clear deleted browser history.)
#!/bin/sh
# Usage: ./vacuum_all.sh ~/.config/google-chrome ~/.mozilla
find "$1" -type f -print0|while read -d $'\0' fname; do
type=`file -b "$fname"`
case "$type" in
SQLite*)
echo "$fname"
sqlite3 "$fname" "VACUUM;" || exit $?
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment