-
-
Save fnicastri/443c1ee17c5114b687c62007beb693e0 to your computer and use it in GitHub Desktop.
Backup script for Mac OS X home directory by rsync
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/sh | |
CMDNAME=`basename $0` | |
while getopts n OPT | |
do | |
case $OPT in | |
"n" ) DRY_RUN="--dry-run" ;; | |
* ) echo "Usage: $CMDNAME [-n]" 1>&2 | |
exit 1 ;; | |
esac | |
done | |
SOURCE=${HOME}/ | |
TARGET=/Volumes/BACKUP/TARGET | |
[[ ! -d $TARGET ]] && echo "Target directory does NOT exists." && exit 1 | |
rsync -av --stats --delete-excluded --modify-window=1 $DRY_RUN \ | |
--include "/.ssh/" \ | |
--include "/.dotfiles/" \ | |
--include "/Library/Keychains/*" \ | |
--include "/Library/Application?Support/Adium?2.0/" \ | |
--include "/Library/Application?Support/Cyberduck/" \ | |
--include "/Library/Application?Support/GitHub?for?Mac/" \ | |
--include "/Library/Application?Support/KeyRemap4MacBook/" \ | |
--include "/Library/Application?Support/Postbox/" \ | |
--include "/Library/Application?Support/Sequel?Pro/" \ | |
--include "/Library/Application?Support/Skype/" \ | |
--exclude "/.*" \ | |
--exclude "/perl5/" \ | |
--exclude "/Dropbox/" \ | |
--exclude "/Pictures/" \ | |
--exclude "/Movies/" \ | |
--exclude "/Music/" \ | |
--exclude "/Library/*/*" \ | |
--exclude ".DS_Store" \ | |
--exclude ".localized" \ | |
${SOURCE} ${TARGET} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment