Skip to content

Instantly share code, notes, and snippets.

@mathcass
Created May 6, 2018 01:57
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 mathcass/2f82b59f0bf22e0050937a000e82cc9b to your computer and use it in GitHub Desktop.
Save mathcass/2f82b59f0bf22e0050937a000e82cc9b to your computer and use it in GitHub Desktop.
Simple BASH script to backup Mozilla bookmarks to script location directory
#!/bin/bash
# The intent here is to copy a daily backup of Mozilla bookmarks. Because the
# SQLITE database file can be as large as 25+ megabytes, if it has been backed up
# within the last day, there's no need to copy it over again.
# If there is a copy of the database already, bail. Otherwise, copy it.
MOZILLA_DIR="$HOME/.mozilla"
DIR=$(dirname $0)
BOOKMARK_PATH="$DIR"
TOTAL_FILES=$(find $DIR -maxdepth 1 -type f -mtime -1 -iname "places*.sqlite"| wc -l)
if [ $TOTAL_FILES -eq 0 ]; then
# echo "Would copy file"
cp $(find $MOZILLA_DIR -iname "places.sqlite") $DIR/places_$(date +%Y-%m-%d_%H-%M-%S).sqlite
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment