Created
April 4, 2016 08:48
-
-
Save PMK/22a0fde46bf497fd7d732baa07504071 to your computer and use it in GitHub Desktop.
Mozilla Firefox profile (w/ bookmarks, history and addons) backup Bash script for Mac OS X
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/bash | |
##### | |
# Created by PMK | |
# https://github.com/PMK | |
# | |
# License: Public Domain | |
# | |
# Creates a tar archive of the current active profile of Mozilla Firefox. | |
# The profile contains sessions, addons, bookmarks and history. | |
# | |
# Usage: $ backup_script.sh TARGET | |
##### | |
TARGET=$1 | |
if [ -z "$TARGET" ]; then | |
TARGET='./' | |
fi | |
if [ ! -d "$TARGET" ]; then | |
mkdir $TARGET | |
fi | |
# Get the profile id | |
PROFILE_ID=$(grep Path ~/Library/Application\ Support/Firefox/profiles.ini | sed 's/Path=Profiles\///g') | |
PROFILE_PATH=~/Library/Application\ Support/Firefox/Profiles/ | |
BACKUP_FILE_NAME=$(date '+%Y%m%d%H%M')-$(PROFILE_ID).tar.gz | |
tar -zcf $BACKUP_FILE_NAME $PROFILE_PATH/$PROFILE_ID | |
mv $BACKUP_FILE_NAME $TARGET | |
echo 'Done!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment