Skip to content

Instantly share code, notes, and snippets.

@keithmorris
Last active June 5, 2017 10:59
Show Gist options
  • Save keithmorris/5c8167a5774ff80e868d to your computer and use it in GitHub Desktop.
Save keithmorris/5c8167a5774ff80e868d to your computer and use it in GitHub Desktop.
OSX Rsync Backup to External Drive
#!/bin/bash
src=/Users/kmorris
backupPath=/Volumes/Backups/backups
date=`date "+%Y-%m-%dT%H%M%S"`
dirname=backup_$date
excludeFile=/Users/kmorris/bin/backup-excludes.txt
rsync -aAXPlv --exclude-from=$excludeFile --link-dest=$backupPath/latest $src $backupPath/$dirname
rm -f $backupPath/latest
ln -s $backupPath/$dirname $backupPath/latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment