Skip to content

Instantly share code, notes, and snippets.

@ussserrr
Created March 15, 2025 18:39
Show Gist options
  • Save ussserrr/a79b2da86e5af6caecc933ff590cd33d to your computer and use it in GitHub Desktop.
Save ussserrr/a79b2da86e5af6caecc933ff590cd33d to your computer and use it in GitHub Desktop.
Usage: ./rsync.sh /source/folder /destination
#!/usr/bin/env bash
# https://download.samba.org/pub/rsync/rsync.1
#
# --archive: same as "-rlptgoD":
# -r: recurse into directories
# -l: copy symlinks as symlinks
# -p: preserve permissions
# -t: preserve modification times
# -g: preserve group
# -o: preserve owner (super-user only)
# -D: same as "--devices --specials"
# --devices: preserve device files (super-user only)
# --specials: preserve special files
rsync \
--archive \
--info=progress2 \
--itemize-changes \
--no-inc-recursive \
--atimes \
--open-noatime \
--sparse \
--delete \
--human-readable --human-readable \
--exclude='.DS_Store' \
--exclude='._*' \
"$1" "$2"
echo "rsync finished, syncing..."
sync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment