Skip to content

Instantly share code, notes, and snippets.

@samkaufman
Created March 21, 2015 06:16
Show Gist options
  • Select an option

  • Save samkaufman/18f0f9da7df6f4ff5602 to your computer and use it in GitHub Desktop.

Select an option

Save samkaufman/18f0f9da7df6f4ff5602 to your computer and use it in GitHub Desktop.
A little shell script for syncing Baldur's Gate II save games between my iPad and Mac
#!/bin/sh
# mount
#IPADMOUNTPATH=$(mktemp -d 2>/dev/null || mktemp -d -t bg2mnt)
IPADMOUNTPATH=~/syncbg2mnt # use a constant directory so Unison achive files aren't confused
mkdir "$IPADMOUNTPATH" || exit 1
ifuse "$IPADMOUNTPATH" --container com.overhaulgames.baldursgateIIenhancededition || exit 2
# sync
IPADSAVEPATH=${IPADMOUNTPATH%%/}/Library/save
MACSAVEPATH=~/"Library/Containers/com.beamdog.baldursgateIIenhancededition/Data/Documents/Baldur's Gate II - Enhanced Edition/save"
sleep .5 # gives it time to actually be mounted
unison "$IPADSAVEPATH" "$MACSAVEPATH" -batch -ignore "Name .DS_Store" -prefer newer -perms 0 -dontchmod
# done
umount "$IPADMOUNTPATH" || exit 3
rmdir "$IPADMOUNTPATH" || exit 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment