Skip to content

Instantly share code, notes, and snippets.

@kitallis
Last active Nov 26, 2020
Embed
What would you like to do?
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