Skip to content

Instantly share code, notes, and snippets.

@artifactsauce
Created November 2, 2011 01:02
Show Gist options
  • Save artifactsauce/1332529 to your computer and use it in GitHub Desktop.
Save artifactsauce/1332529 to your computer and use it in GitHub Desktop.
Backup script for Mac OS X home directory by rsync
#!/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}
@MarkBTomlinson
Copy link

Just found this and it is beautiful, thanks for uploading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment