Last active
January 6, 2025 10:56
-
-
Save vijinho/8c44dad181ac8b6e6bcada94820342cd to your computer and use it in GitHub Desktop.
fast rsync with an excludes file
This file contains hidden or 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
time $(which rsync) \ | |
--partial \ | |
--delay-updates \ | |
-aAHHSxXESy \ | |
--stats \ | |
--exclude-from=$HOME/.rsync-excludes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Breaking it down:
--partial
: Keeps partially transferred files so that they can be resumed later.--delay-updates
: Delays file permissions updates until the transfer is complete.-aAHHSxXESy
: This option is a combination of several flags:-a
: Archive mode, which preserves symbolic links, file permissions, user & group ownerships, timestamps, and special files.-A
: Preserves ACLs (Access Control Lists).-H
: Preserves extended attributes.-H
: Preserves hard links.-S
: Preserves sparse files.x
: Preserves executability of symlinks.X
: Preserves extended attributes.E
: Preserves extended attributes and file flags (such as immutable).y
: Only copy newer files. This is a shorthand for--update
, which does the same thing but also preserves timestamps.--stats
: Displays statistics at the end of the transfer showing the total number of files transferred, bytes copied, etc.--exclude-from=$HOME/.rsync-excludes
: Specifies a file with a list of patterns to exclude from the synchronization.Using these long options makes it clear what each flag does, which can be particularly helpful when you return to the script after some time or if another person needs to understand and modify it.