Created
November 30, 2014 03:17
-
-
Save dphiffer/ee6abdb13011428ebbf5 to your computer and use it in GitHub Desktop.
Backup your Mac files, and ignore all the weird hidden stufft
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 | |
# backup.sh | |
# Incrementally backup the enclosing folder | |
# Set this to where you want your files to get backed up to (include a trailing | |
# slash). This follows the same format as ssh, but you can also use a local | |
# file path here. | |
TARGET="[email protected]:/volume1/backups/dphiffer/" | |
# Copy everything in the folder where this backup script is saved | |
SOURCE=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | |
# Recursively copy everything, ignoring weird hidden Mac stuff | |
# Also ignoring a special @eaDir folder, which my Synology NAS uses | |
# Note that I've omitted the options to preserve file owner/group metadata | |
# (-o, -g) to make this play nice with my Synology NAS. You may want to read | |
# the output of `rsync --help` and tweak the arguments to your own taste. | |
rsync -vrlptx --delete --ignore-errors \ | |
--exclude "*.DocumentRevisions-V100*" \ | |
--exclude "*.Spotlight-V100*" \ | |
--exclude "*.DS_Store" \ | |
--exclude "*.TemporaryItems*" \ | |
--exclude "*.Trashes*" \ | |
--exclude "*.fseventsd*" \ | |
--exclude "*@eaDir*" \ | |
"$SOURCE" "$TARGET" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment