Skip to content

Instantly share code, notes, and snippets.

@kitallis
Last active November 26, 2020 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitallis/f005cb3ee9fd70c1e14e52cde8ce1226 to your computer and use it in GitHub Desktop.
Save kitallis/f005cb3ee9fd70c1e14e52cde8ce1226 to your computer and use it in GitHub Desktop.
backup pictures over rsync
source="/Users/username/Pictures/"
destination="<u>@<ip>:/mnt/vol/backup/"
# this syncs safely, doesn't trash things on the server if you deleted locally, only accretes, only includes pictures
# for the rest of my mac I just rely on Time Machine backups
# includes a per-file progress bar (from rsync) and an overall progress bar using the pv utility
rsync -Phca --ignore-existing --bwlimit=1000 --stats --include="*" --include="Pictures/Photos Library.photoslibrary/" --include="Pictures/Photos Library.photoslibrary/***" -e "ssh" "$source" "$destination" | pv -lep -s $(rsync -av --dry-run "$source" "$destination" | awk 'NF' | wc -l)
# in bash_profile or equivalent,
alias backup='$HOME/bin/backup'
15 11 * * * yourusername ~yourusername/bin/backup.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment