Skip to content

Instantly share code, notes, and snippets.

@haikusw
Forked from incanus/safari_backup.sh
Created February 8, 2024 07:10
Show Gist options
  • Save haikusw/1529a1e16d398bdfd823c1cdd4ec5623 to your computer and use it in GitHub Desktop.
Save haikusw/1529a1e16d398bdfd823c1cdd4ec5623 to your computer and use it in GitHub Desktop.
#!/bin/sh
SRC1=$HOME/Library/Safari
SRC2=$HOME/Library/Containers/com.apple.Safari/Data/Library/Safari
HOST=$( hostname | sed 's/\..*//' )
HOUR=$( date +"%H" )
DST=$HOME/Sync/Safari/$HOST/$HOUR
mkdir -p $DST 2>/dev/null
cd $SRC1
cp \
Bookmarks.plist \
CloudTabs.db \
History.db \
LastSession.plist \
RecentlyClosedTabs.plist \
$DST 2>/dev/null
cd $SRC2
cp \
SafariTabs.db \
$DST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment