neulab/tldr huggingface dataset:
This option can help to reduce the risk of an rsync being run as root into or out of a directory that might have live changes happening to it and you want to make sure that root-level read or write actions of system files are not possible.  While you could alternatively run all of rsync as the specified user, sometimes you need the root-level host-access credentials to be used, so this allows rsync to drop root for the copying part of the operation after the remote-shell or daemon connection is established.
The option only affects one side of the transfer unless the transfer is local, in which case it affects both sides.  Use the --remote-option to affect the remote side, such as -M--copy- as=joe.  For a local transfer, the lsh (or lsh.sh) support file provides a local-shell helper script that can be used to allow a "localhost:" or "lh:" host-spec to be specified without needing to setup any remote shells, allowing you to specify remote options that affect the side of the transfer that is using the host-spec (and using hostname "lh" avoids the overriding of the remote directory to the user's home dir).
For example, the following rsync writes the local files as user "joe":
sudo rsync -aiv --copy-as=joe host1:backups/joe/ /home/joe/
This makes all files owned by user "joe", limits the groups to those that are available to that user, and makes it impossible for the joe user to do a timed exploit of the path to induce a change to a file that the joe user has no permissions to change.
The following command does a local copy into the "dest/" dir as user "joe" (assuming you've installed support/lsh into a dir on your $PATH):
sudo rsync -aive lsh -M--copy-as=joe src/ lh:dest/
--temp-dir=DIR, -T This option instructs rsync to use DIR as a scratch directory when creating temporary copies of the files transferred on the receiving side.  The default behavior is to create each temporary file in the same directory as the associated destination file. Beginning with rsync 3.1.1, the temp-file names inside the specified DIR will not be prefixed with an extra dot (though they will still have a random suffix added).
This option is most often used when the receiving disk partition does not have enough free space to hold a copy of the largest file in the transfer.  In this case (i.e. when the scratch directory is on a different disk partition), rsync will not be able to rename each received temporary file over the top of the associated destination file, but instead must copy it into place.  Rsync does this by copying the file over the top of the destination file, which means that the destination file will contain truncated data during this copy.  If this were not done this way (even if the destination file were first removed, the data locally copied to a temporary file in the destination directory, and then renamed into place) it would be possible for the old file to continue taking up disk space (if someone had it open), and thus there might not be enough room to fit the new version on the disk at the same time.
If you are using this option for reasons other than a shortage of disk space, you may wish to combine it with the --delay-updates option, which will ensure that all copied files get put into subdirectories in the destination hierarchy, awaiting the end of the transfer.  If you don't have enough room to duplicate all the arriving files on the destination partition, another way to tell rsync that you aren't overly concerned about disk space is to use the --partial-dir option with a relative path; because this tells rsync that it is OK to stash off a copy of a single file in a subdir in the destination hierarchy, rsync will use the partial- dir as a staging area to bring over the copied file, and then rename it into place from there. (Specifying a --partial-dir with an absolute path does not have this side-effect.)
--fuzzy, -y This option tells rsync that it should look for a basis file for any destination file that is missing.  The current algorithm looks in the same directory as the destination file for either a file that has an identical size and modified-time, or a similarly-named file.  If found, rsync uses the fuzzy basis file to try to speed up the transfer.
If the option is repeated, the fuzzy scan will also be done in any matching alternate destination directories that are specified via --compare-dest, --copy-dest, or --link-dest.
Note that the use of the --delete option might get rid of any potential fuzzy-match files, so either use --delete-after or specify some filename exclusions if you need to prevent this.
--compare-dest=DIR This option instructs rsync to use DIR on the destination machine as an additional hierarchy to compare destination files against doing transfers (if the files are missing in the destination directory).  If a file is found in DIR that is identical to the sender's file, the file will NOT be transferred to the destination directory.  This is useful for creating a sparse backup of just files that have changed from an earlier backup.  This option is typically used to copy into an empty (or newly created) directory.
Beginning in version 2.6.4, multiple --compare-dest directories may be provided, which will cause rsync to search the list in the order specified for an exact match.  If a match is found that differs only in attributes, a local copy is made and the attributes updated.  If a match is not found, a basis file from one of the DIRs will be selected to try to speed up the transfer.
If DIR is a relative path, it is relative to the destination directory.  See also --copy-dest and --link-dest.
NOTE: beginning with version 3.1.0, rsync will remove a file from a non-empty destination hierarchy if an exact match is found in one of the compare-dest hierarchies (making the end result more closely match a fresh copy).
--copy-dest=DIR This option behaves like --compare-dest, but rsync will also copy unchanged files found in DIR to the destination directory using a local copy.  This is useful for doing transfers to a new destination while leaving existing files intact, and then doing a flash-cutover when all files have been successfully transferred.
Multiple --copy-dest directories may be provided, which will cause rsync to search the list in the order specified for an unchanged file.  If a match is not found, a basis file from one of the DIRs will be selected to try to speed up the transfer.
If DIR is a relative path, it is relative to the destination directory.  See also --compare-dest and --link-dest.
--link-dest=DIR This option behaves like --copy-dest, but unchanged files are hard linked from DIR to the destination directory.  The files must be identical in all preserved attributes (e.g. permissions, possibly ownership) in order for the files to be linked together.  An example:
rsync -av --link-dest=$PWD/prior_dir host:src_dir/ new_dir/
If file's aren't linking, double-check their attributes.  Also check if some attributes are getting forced outside of rsync's control, such a mount option that squishes root to a single user, or mounts a removable drive with generic ownership (such as OS X's "Ignore ownership on this volume" option).
Beginning in version 2.6.4, multiple --link-dest directories may be provided, which will cause rsync to search the list in the order specified for an exact match (there is a limit of 20 such directories).  If a match is found that differs only in attributes, a local copy is made and the attributes updated.  If a match is not found, a basis file from one of the DIRs will be selected to try to speed up the transfer.
This option works best when copying into an empty destination hierarchy, as existing files may get their attributes tweaked, and that can affect alternate destination files via hard-links.  Also, itemizing of changes can get a bit muddled.  Note that prior to version 3.1.0, an alternate-directory exact match would never be found (nor linked into the destination) when a destination file already exists.
Note that if you combine this option with --ignore-times, rsync will not link any files together because it only links identical files together as a substitute for transferring the file, never as an additional check after the file is updated.
If DIR is a relative path, it is relative to the destination directory.  See also --compare-dest and --copy-dest.
Note that rsync versions prior to 2.6.1 had a bug that could prevent --link-dest from working properly for a non-super-user when -o was specified (or implied by -a).  You can work-around this bug by avoiding the -o option when sending to an old rsync.
--compress, -z With this option, rsync compresses the file data as it is sent to the destination machine, which reduces the amount of data being transmitted -- something that is useful over a slow connection.
Rsync supports multiple compression methods and will choose one for you unless you force the choice using the --compress-choice (--zc) option.
Run rsync --version to see the default compress list compiled into your version.
When both sides of the transfer are at least 3.2.0, rsync chooses the first algorithm in the client's list of choices that is also in the server's list of choices.  If no common compress choice is found, rsync exits with an error.  If the remote rsync is too old to support checksum negotiation, its list is assumed to be "zlib".
The default order can be customized by setting the environment variable RSYNC_COMPRESS_LIST to a space-separated list of acceptable compression names.  If the string contains a "&" character, it is separated into the "client string & server string", otherwise the same string applies to both.  If the string (or string portion) contains no non-whitespace characters, the default compress list is used.  Any unknown compression names are discarded from the list, but a list with only invalid names results in a failed negotiation.
There are some older rsync versions that were configured to reject a -z option and require the use of -zz because their compression library was not compatible with the default zlib compression method.  You can usually ignore this weirdness unless the rsync server complains and tells you to specify -zz.
See also the --skip-compress option for the default list of file suffixes that will be transferred with no (or minimal) compression.
--compress-choice=STR, --zc=STR This option can be used to override the automatic negotiation of the compression algorithm that occurs when --compress is used. The option implies --compress unless "none" was specified, which instead implies --no-compress.
The compression options that you may be able to use are:
o      zstd
o      lz4
o      zlibx
o      zlib
Run rsync --version to see the default compress list compiled into your version (which may differ from the list above).
Note that if you see an error about an option named --old-compress or --new-compress, this is rsync trying to send the --compress- choice=zlib or --compress-choice=zlibx option in a backward- compatible manner that more rsync versions understand.  This error indicates that the older rsync version on the server will not allow you to force the compression type.
Note that the "zlibx" compression algorithm is just the "zlib" algorithm with matched data excluded from the compression stream (to try to make it more compatible with an external zlib implementation).
--compress-level=NUM, --zl=NUM Explicitly set the compression level to use (see --compress, -z) instead of letting it default.  The --compress option is implied as long as the level chosen is not a "don't compress" level for the compression algorithm that is in effect (e.g. zlib compression treats level 0 as "off").
The level values vary depending on the checksum in effect. Because rsync will negotiate a checksum choice by default (when the remote rsync is new enough), it can be good to combine this option with a --compress-choice (--zc) option unless you're sure of the choice in effect.  For example:
rsync -aiv --zc=zstd --zl=22 host:src/ dest/
For zlib & zlibx compression the valid values are from 1 to 9 with 6 being the default.  Specifying 0 turns compression off, and specifying -1 chooses the default of 6.
For zstd compression the valid values are from -131072 to 22 with 3 being the default. Specifying 0 chooses the default of 3.
For lz4 compression there are no levels, so the value is always 0.
If you specify a too-large or too-small value, the number is silently limited to a valid value.  This allows you to specify something like --zl=999999999 and be assured that you'll end up with the maximum compression level no matter what algorithm was chosen.
If you want to know the compression level that is in effect, specify --debug=nstr to see the "negotiated string" results.  This will report something like "Client compress: zstd (level 3)" (along with the checksum choice in effect).
--skip-compress=LIST Override the list of file suffixes that will be compressed as little as possible.  Rsync sets the compression level on a per- file basis based on the file's suffix.  If the compression algorithm has an "off" level (such as zlib/zlibx) then no compression occurs for those files.  Other algorithms that support changing the streaming level on-the-fly will have the level minimized to reduces the CPU usage as much as possible for a matching file.  At this time, only zlib & zlibx compression support this changing of levels on a per-file basis.
The LIST should be one or more file suffixes (without the dot) separated by slashes (/).  You may specify an empty string to indicate that no files should be skipped.
Simple character-class matching is supported: each must consist of a list of letters inside the square brackets (e.g. no special classes, such as "[:alpha:]", are supported, and '-' has no special meaning).
The characters asterisk (*) and question-mark (?) have no special meaning.
Here's an example that specifies 6 suffixes to skip (since 1 of the 5 rules matches 2 suffixes):
--skip-compress=gz/jpg/mp[34]/7z/bz2
The default file suffixes in the skip-compress list in this version of rsync are:
3g2 3gp 7z aac ace apk avi bz2 deb dmg ear f4v flac flv gpg gz iso jar jpeg jpg lrz lz lz4 lzma lzo m1a m1v m2a m2ts m2v m4a m4b m4p m4r m4v mka mkv mov mp1 mp2 mp3 mp4 mpa mpeg mpg mpv mts odb odf odg odi odm odp ods odt oga ogg ogm ogv ogx opus otg oth otp ots ott oxt png qt rar rpm rz rzip spx squashfs sxc sxd sxg sxm sxw sz tbz tbz2 tgz tlz ts txz tzo vob war webm webp xz z zip zst
This list will be replaced by your --skip-compress list in all but one situation: a copy from a daemon rsync will add your skipped suffixes to its list of non-compressing files (and its list may be configured to a different default).
--numeric-ids With this option rsync will transfer numeric group and user IDs rather than using user and group names and mapping them at both ends.
By default rsync will use the username and groupname to determine what ownership to give files.  The special uid 0 and the special group 0 are never mapped via user/group names even if the --numeric-ids option is not specified.
If a user or group has no name on the source system or it has no match on the destination system, then the numeric ID from the source system is used instead.  See also the comments on the "use chroot" setting in the rsyncd.conf manpage for information on how the chroot setting affects rsync's ability to look up the names of the users and groups and what you can do about it.
--usermap=STRING, --groupmap=STRING These options allow you to specify users and groups that should be mapped to other values by the receiving side.  The STRING is one or more FROM:TO pairs of values separated by commas.  Any matching FROM value from the sender is replaced with a TO value from the receiver.  You may specify usernames or user IDs for the FROM and TO values, and the FROM value may also be a wild-card string, which will be matched against the sender's names (wild-cards do NOT match against ID numbers, though see below for why a '*' matches everything).  You may instead specify a range of ID numbers via an inclusive range: LOW-HIGH.  For example:
--usermap=0-99:nobody,wayne:admin,*:normal --groupmap=usr:1,1:usr
The first match in the list is the one that is used.  You should specify all your user mappings using a single --usermap option, and/or all your group mappings using a single --groupmap option.
Note that the sender's name for the 0 user and group are not transmitted to the receiver, so you should either match these values using a 0, or use the names in effect on the receiving side (typically "root").  All other FROM names match those in use on the sending side.  All TO names match those in use on the receiving side.
Any IDs that do not have a name on the sending side are treated as having an empty name for the purpose of matching.  This allows them to be matched via a "*" or using an empty name.  For instance:
--usermap=:nobody --groupmap=*:nobody
When the --numeric-ids option is used, the sender does not send any names, so all the IDs are treated as having an empty name. This means that you will need to specify numeric FROM values if you want to map these nameless IDs to different values.
For the --usermap option to have any effect, the -o (--owner) option must be used (or implied), and the receiver will need to be running as a super-user (see also the --fake-super option).  For the --groupmap option to have any effect, the -g (--groups) option must be used (or implied), and the receiver will need to have permissions to set that group.
If your shell complains about the wildcards, use --protect-args (-s).
--chown=USER:GROUP This option forces all files to be owned by USER with group GROUP. This is a simpler interface than using --usermap and --groupmap directly, but it is implemented using those options internally, so you cannot mix them.  If either the USER or GROUP is empty, no mapping for the omitted user/group will occur.  If GROUP is empty, the trailing colon may be omitted, but if USER is empty, a leading colon must be supplied.
If you specify "--chown=foo:bar", this is exactly the same as specifying "--usermap=*:foo --groupmap=*:bar", only easier.  If your shell complains about the wildcards, use --protect-args (-s).
--timeout=SECONDS This option allows you to set a maximum I/O timeout in seconds. If no data is transferred for the specified time then rsync will exit.  The default is 0, which means no timeout.
--contimeout=SECONDS This option allows you to set the amount of time that rsync will wait for its connection to an rsync daemon to succeed.  If the timeout is reached, rsync exits with an error.
--address=ADDRESS By default rsync will bind to the wildcard address when connecting to an rsync daemon.  The --address option allows you to specify a specific IP address (or hostname) to bind to.  See also this option in the --daemon mode section.
--port=PORT This specifies an alternate TCP port number to use rather than the default of 873.  This is only needed if you are using the double- colon (::) syntax to connect with an rsync daemon (since the URL syntax has a way to specify the port as a part of the URL).  See also this option in the --daemon mode section.
--sockopts=OPTIONS This option can provide endless fun for people who like to tune their systems to the utmost degree.  You can set all sorts of socket options which may make transfers faster (or slower!).  Read the man page for the setsockopt() system call for details on some of the options you may be able to set.  By default no special socket options are set.  This only affects direct socket connections to a remote rsync daemon.
This option also exists in the --daemon mode section.
--blocking-io This tells rsync to use blocking I/O when launching a remote shell transport.  If the remote shell is either rsh or remsh, rsync defaults to using blocking I/O, otherwise it defaults to using non-blocking I/O. (Note that ssh prefers non-blocking I/O.)
--outbuf=MODE This sets the output buffering mode.  The mode can be None (aka Unbuffered), Line, or Block (aka Full).  You may specify as little as a single letter for the mode, and use upper or lower case.
The main use of this option is to change Full buffering to Line buffering when rsync's output is going to a file or pipe.
--itemize-changes, -i Requests a simple itemized list of the changes that are being made to each file, including attribute changes.  This is exactly the same as specifying --out-format='%i %n%L'.  If you repeat the option, unchanged files will also be output, but only if the receiving rsync is at least version 2.6.7 (you can use -vv with older versions of rsync, but that also turns on the output of other verbose messages).
The "%i" escape has a cryptic output that is 11 letters long.  The general format is like the string YXcstpoguax, where Y is replaced by the type of update being done, X is replaced by the file-type, and the other letters represent attributes that may be output if they are being modified.
The update types that replace the Y are as follows:
o      A < means that a file is being transferred to the remote host (sent).
o      A > means that a file is being transferred to the local host (received).
o      A c means that a local change/creation is occurring for the item (such as the creation of a directory or the changing of a symlink, etc.).
o      A h means that the item is a hard link to another item (requires --hard-links).
o      A . means that the item is not being updated (though it might have attributes that are being modified).
o      A * means that the rest of the itemized-output area contains a message (e.g. "deleting").
The file-types that replace the X are: f for a file, a d for a directory, an L for a symlink, a D for a device, and a S for a special file (e.g. named sockets and fifos).
The other letters in the string indicate if some attributes of the file have changed, as follows:
o      "." - the attribute is unchanged.
o      "+" - the file is newly created.
o      " " - all the attributes are unchanged (all dots turn to spaces).
o      "?" - the change is unknown (when the remote rsync is old).
o      A letter indicates an attribute is being updated.
The attribute that is associated with each letter is as follows:
o      A c means either that a regular file has a different checksum (requires --checksum) or that a symlink, device, or special file has a changed value.  Note that if you are sending files to an rsync prior to 3.0.1, this change flag will be present only for checksum-differing regular files.
o      A s means the size of a regular file is different and will be updated by the file transfer.
o      A t means the modification time is different and is being updated to the sender's value (requires --times).  An alternate value of T means that the modification time will be set to the transfer time, which happens when a file/symlink/device is updated without --times and when a symlink is changed and the receiver can't set its time. (Note: when using an rsync 3.0.0 client, you might see the s flag combined with t instead of the proper T flag for this time-setting failure.)
o      A p means the permissions are different and are being updated to the sender's value (requires --perms).
o      An o means the owner is different and is being updated to the sender's value (requires --owner and super-user privileges).
o      A g means the group is different and is being updated to the sender's value (requires --group and the authority to set the group).
o      A u|n|b indicates the following information: u  means the access (use) time is different and is being updated to the sender's value (requires --atimes); n means the create time (newness) is different and is being updated to the sender's value (requires --crtimes); b means that both the access and create times are being updated.
o      The a means that the ACL information is being changed.
o      The x means that the extended attribute information is being changed.
One other output is possible: when deleting files, the "%i" will output the string "*deleting" for each item that is being removed (assuming that you are talking to a recent enough rsync that it logs deletions instead of outputting them as a verbose message).
--out-format=FORMAT This allows you to specify exactly what the rsync client outputs to the user on a per-update basis.  The format is a text string containing embedded single-character escape sequences prefixed with a percent (%) character.  A default format of "%n%L" is assumed if either --info=name or -v is specified (this tells you just the name of the file and, if the item is a link, where it points).  For a full list of the possible escape characters, see the "log format" setting in the rsyncd.conf manpage.
Specifying the --out-format option implies the --info=name option, which will mention each file, dir, etc. that gets updated in a significant way (a transferred file, a recreated symlink/device, or a touched directory).  In addition, if the itemize-changes escape (%i) is included in the string (e.g. if the --itemize- changes option was used), the logging of names increases to mention any item that is changed in any way (as long as the receiving side is at least 2.6.4).  See the --itemize-changes option for a description of the output of "%i".
Rsync will output the out-format string prior to a file's transfer unless one of the transfer-statistic escapes is requested, in which case the logging is done at the end of the file's transfer. When this late logging is in effect and --progress is also specified, rsync will also output the name of the file being transferred prior to its progress information (followed, of course, by the out-format output).
--log-file=FILE This option causes rsync to log what it is doing to a file.  This is similar to the logging that a daemon does, but can be requested for the client side and/or the server side of a non-daemon transfer.  If specified as a client option, transfer logging will be enabled with a default format of "%i %n%L".  See the --log- file-format option if you wish to override this.
Here's a example command that requests the remote side to log what is happening:
rsync -av --remote-option=--log-file=/tmp/rlog src/ dest/
This is very useful if you need to debug why a connection is closing unexpectedly.
--log-file-format=FORMAT This allows you to specify exactly what per-update logging is put into the file specified by the --log-file option (which must also be specified for this option to have any effect).  If you specify an empty string, updated files will not be mentioned in the log file.  For a list of the possible escape characters, see the "log format" setting in the rsyncd.conf manpage.
The default FORMAT used if --log-file is specified and this option is not is '%i %n%L'.
--stats This tells rsync to print a verbose set of statistics on the file transfer, allowing you to tell how effective rsync's delta- transfer algorithm is for your data.  This option is equivalent to --info=stats2 if combined with 0 or 1 -v options, or --info=stats3 if combined with 2 or more -v options.
The current statistics are as follows:
o      Number of files is the count of all "files" (in the generic sense), which includes directories, symlinks, etc.  The total count will be followed by a list of counts by filetype (if the total is non-zero).  For example: "(reg: 5, dir: 3, link: 2, dev: 1, special: 1)" lists the totals for regular files, directories, symlinks, devices, and special files.  If any of value is 0, it is completely omitted from the list.
o      Number of created files is the count of how many "files" (generic sense) were created (as opposed to updated).  The total count will be followed by a list of counts by filetype (if the total is non-zero).
o      Number of deleted files is the count of how many "files" (generic sense) were created (as opposed to updated).  The total count will be followed by a list of counts by filetype (if the total is non-zero).  Note that this line is only output if deletions are in effect, and only if protocol 31 is being used (the default for rsync 3.1.x).
o      Number of regular files transferred is the count of normal files that were updated via rsync's delta-transfer algorithm, which does not include dirs, symlinks, etc. Note that rsync 3.1.0 added the word "regular" into this heading.
o      Total file size is the total sum of all file sizes in the transfer.  This does not count any size for directories or special files, but does include the size of symlinks.
o      Total transferred file size is the total sum of all files sizes for just the transferred files.
o      Literal data is how much unmatched file-update data we had to send to the receiver for it to recreate the updated files.
o      Matched data is how much data the receiver got locally when recreating the updated files.
o      File list size is how big the file-list data was when the sender sent it to the receiver.  This is smaller than the in-memory size for the file list due to some compressing of duplicated data when rsync sends the list.
o      File list generation time is the number of seconds that the sender spent creating the file list.  This requires a modern rsync on the sending side for this to be present.
o      File list transfer time is the number of seconds that the sender spent sending the file list to the receiver.
o      Total bytes sent is the count of all the bytes that rsync sent from the client side to the server side.
o      Total bytes received is the count of all non-message bytes that rsync received by the client side from the server side. "Non-message" bytes means that we don't count the bytes for a verbose message that the server sent to us, which makes the stats more consistent.
--8-bit-output, -8 This tells rsync to leave all high-bit characters unescaped in the output instead of trying to test them to see if they're valid in the current locale and escaping the invalid ones.  All control characters (but never tabs) are always escaped, regardless of this option's setting.
The escape idiom that started in 2.6.7 is to output a literal backslash (\) and a hash (#), followed by exactly 3 octal digits. For example, a newline would output as "\#012".  A literal backslash that is in a filename is not escaped unless it is followed by a hash and 3 digits (0-9).
--human-readable, -h Output numbers in a more human-readable format.  There are 3 possible levels: (1) output numbers with a separator between each set of 3 digits (either a comma or a period, depending on if the decimal point is represented by a period or a comma); (2) output numbers in units of 1000 (with a character suffix for larger units -- see below); (3) output numbers in units of 1024.
The default is human-readable level 1.  Each -h option increases the level by one.  You can take the level down to 0 (to output numbers as pure digits) by specifying the --no-human-readable (--no-h) option.
The unit letters that are appended in levels 2 and 3 are: K (kilo), M (mega), G (giga), T (tera), or P (peta).  For example, a 1234567-byte file would output as 1.23M in level-2 (assuming that a period is your local decimal point).
Backward compatibility note: versions of rsync prior to 3.1.0 do not support human-readable level 1, and they default to level 0. Thus, specifying one or two -h options will behave in a comparable manner in old and new versions as long as you didn't specify a --no-h option prior to one or more -h options.  See the --list- only option for one difference.
--partial By default, rsync will delete any partially transferred file if the transfer is interrupted.  In some circumstances it is more desirable to keep partially transferred files.  Using the --partial option tells rsync to keep the partial file which should make a subsequent transfer of the rest of the file much faster.
--partial-dir=DIR A better way to keep partial files than the --partial option is to specify a DIR that will be used to hold the partial data (instead of writing it out to the destination file).  On the next transfer, rsync will use a file found in this dir as data to speed up the resumption of the transfer and then delete it after it has served its purpose.
Note that if --whole-file is specified (or implied), any partial- dir file that is found for a file that is being updated will simply be removed (since rsync is sending files without using rsync's delta-transfer algorithm).
Rsync will create the DIR if it is missing (just the last dir -- not the whole path).  This makes it easy to use a relative path (such as "--partial-dir=.rsync-partial") to have rsync create the partial-directory in the destination file's directory when needed, and then remove it again when the partial file is deleted.  Note that the directory is only removed if it is a relative pathname, as it is expected that an absolute path is to a directory that is reserved for partial-dir work.
If the partial-dir value is not an absolute path, rsync will add an exclude rule at the end of all your existing excludes.  This will prevent the sending of any partial-dir files that may exist on the sending side, and will also prevent the untimely deletion of partial-dir items on the receiving side.  An example: the above --partial-dir option would add the equivalent of "-f '-p .rsync- partial/'" at the end of any other filter rules.
If you are supplying your own exclude rules, you may need to add your own exclude/hide/protect rule for the partial-dir because (1) the auto-added rule may be ineffective at the end of your other rules, or (2) you may wish to override rsync's exclude choice. For instance, if you want to make rsync clean-up any left-over partial-dirs that may be lying around, you should specify --delete-after and add a "risk" filter rule, e.g.  -f 'R .rsync- partial/'. (Avoid using --delete-before or --delete-during unless you don't need rsync to use any of the left-over partial-dir data during the current run.)
IMPORTANT: the --partial-dir should not be writable by other users or it is a security risk.  E.g. AVOID "/tmp".
You can also set the partial-dir value the RSYNC_PARTIAL_DIR environment variable.  Setting this in the environment does not force --partial to be enabled, but rather it affects where partial files go when --partial is specified.  For instance, instead of using --partial-dir=.rsync-tmp along with --progress, you could set RSYNC_PARTIAL_DIR=.rsync-tmp in your environment and then just use the -P option to turn on the use of the .rsync-tmp dir for partial transfers.  The only times that the --partial option does not look for this environment value are (1) when --inplace was specified (since --inplace conflicts with --partial-dir), and (2) when --delay-updates was specified (see below).
When a modern rsync resumes the transfer of a file in the partial- dir, that partial file is now updated in-place instead of creating yet another tmp-file copy (so it maxes out at dest + tmp instead of dest + partial + tmp).  This requires both ends of the transfer to be at least version 3.2.0.
For the purposes of the daemon-config's "refuse options" setting, --partial-dir does not imply --partial.  This is so that a refusal of the --partial option can be used to disallow the overwriting of destination files with a partial transfer, while still allowing the safer idiom provided by --partial-dir.
--delay-updates This option puts the temporary file from each updated file into a holding directory until the end of the transfer, at which time all the files are renamed into place in rapid succession.  This attempts to make the updating of the files a little more atomic. By default the files are placed into a directory named .~tmp~ in each file's destination directory, but if you've specified the --partial-dir option, that directory will be used instead.  See the comments in the --partial-dir section for a discussion of how this .~tmp~ dir will be excluded from the transfer, and what you can do if you want rsync to cleanup old .~tmp~ dirs that might be lying around.  Conflicts with --inplace and --append.
This option implies --no-inc-recursive since it needs the full file list in memory in order to be able to iterate over it at the end.
This option uses more memory on the receiving side (one bit per file transferred) and also requires enough free disk space on the receiving side to hold an additional copy of all the updated files.  Note also that you should not use an absolute path to --partial-dir unless (1) there is no chance of any of the files in the transfer having the same name (since all the updated files will be put into a single directory if the path is absolute) and (2) there are no mount points in the hierarchy (since the delayed updates will fail if they can't be renamed into place).
See also the "atomic-rsync" perl script in the "support" subdir for an update algorithm that is even more atomic (it uses --link- dest and a parallel hierarchy of files).
--prune-empty-dirs, -m This option tells the receiving rsync to get rid of empty directories from the file-list, including nested directories that have no non-directory children.  This is useful for avoiding the creation of a bunch of useless directories when the sending rsync is recursively scanning a hierarchy of files using include/exclude/filter rules.
Note that the use of transfer rules, such as the --min-size option, does not affect what goes into the file list, and thus does not leave directories empty, even if none of the files in a directory match the transfer rule.
Because the file-list is actually being pruned, this option also affects what directories get deleted when a delete is active. However, keep in mind that excluded files and directories can prevent existing items from being deleted due to an exclude both hiding source files and protecting destination files.  See the perishable filter-rule option for how to avoid this.
You can prevent the pruning of certain empty directories from the file-list by using a global "protect" filter.  For instance, this option would ensure that the directory "emptydir" was kept in the file-list:
--filter 'protect emptydir/'
Here's an example that copies all .pdf files in a hierarchy, only creating the necessary destination directories to hold the .pdf files, and ensures that any superfluous files and directories in the destination are removed (note the hide filter of non- directories being used instead of an exclude):
rsync -avm --del --include='*.pdf' -f 'hide,! */' src/ dest
If you didn't want to remove superfluous destination files, the more time-honored options of --include='*/' --exclude='*' would work fine in place of the hide-filter (if that is more natural to you).
--progress This option tells rsync to print information showing the progress of the transfer.  This gives a bored user something to watch. With a modern rsync this is the same as specifying --info=flist2,name,progress, but any user-supplied settings for those info flags takes precedence (e.g. "--info=flist0 --progress").
While rsync is transferring a regular file, it updates a progress line that looks like this:
782448  63%  110.64kB/s    0:00:04
In this example, the receiver has reconstructed 782448 bytes or 63% of the sender's file, which is being reconstructed at a rate of 110.64 kilobytes per second, and the transfer will finish in 4 seconds if the current rate is maintained until the end.
These statistics can be misleading if rsync's delta-transfer algorithm is in use.  For example, if the sender's file consists of the basis file followed by additional data, the reported rate will probably drop dramatically when the receiver gets to the literal data, and the transfer will probably take much longer to finish than the receiver estimated as it was finishing the matched part of the file.
When the file transfer finishes, rsync replaces the progress line with a summary line that looks like this:
1,238,099 100%  146.38kB/s    0:00:08  (xfr#5, to-chk=169/396)
In this example, the file was 1,238,099 bytes long in total, the average rate of transfer for the whole file was 146.38 kilobytes per second over the 8 seconds that it took to complete, it was the 5th transfer of a regular file during the current rsync session, and there are 169 more files for the receiver to check (to see if they are up-to-date or not) remaining out of the 396 total files in the file-list.
In an incremental recursion scan, rsync won't know the total number of files in the file-list until it reaches the ends of the scan, but since it starts to transfer files during the scan, it will display a line with the text "ir-chk" (for incremental recursion check) instead of "to-chk" until the point that it knows the full size of the list, at which point it will switch to using "to-chk".  Thus, seeing "ir-chk" lets you know that the total count of files in the file list is still going to increase (and each time it does, the count of files left to check will increase by the number of the files added to the list).
-P     The -P option is equivalent to --partial --progress.  Its purpose is to make it much easier to specify these two options for a long transfer that may be interrupted.
There is also a --info=progress2 option that outputs statistics based on the whole transfer, rather than individual files.  Use this flag without outputting a filename (e.g. avoid -v or specify --info=name0) if you want to see how the transfer is doing without scrolling the screen with a lot of names. (You don't need to specify the --progress option in order to use --info=progress2.)
Finally, you can get an instant progress report by sending rsync a signal of either SIGINFO or SIGVTALRM.  On BSD systems, a SIGINFO is generated by typing a Ctrl+T (Linux doesn't currently support a SIGINFO signal).  When the client-side process receives one of those signals, it sets a flag to output a single progress report which is output when the current file transfer finishes (so it may take a little time if a big file is being handled when the signal arrives).  A filename is output (if needed) followed by the --info=progress2 format of progress info.  If you don't know which of the 3 rsync processes is the client process, it's OK to signal all of them (since the non-client processes ignore the signal).
CAUTION: sending SIGVTALRM to an older rsync (pre-3.2.0) will kill it.
--password-file=FILE This option allows you to provide a password for accessing an rsync daemon via a file or via standard input if FILE is -.  The file should contain just the password on the first line (all other lines are ignored).  Rsync will exit with an error if FILE is world readable or if a root-run rsync command finds a non-root- owned file.
This option does not supply a password to a remote shell transport such as ssh; to learn how to do that, consult the remote shell's documentation.  When accessing an rsync daemon using a remote shell as the transport, this option only comes into effect after the remote shell finishes its authentication (i.e. if you have also specified a password in the daemon's config file).
--early-input=FILE This option allows rsync to send up to 5K of data to the "early exec" script on its stdin.  One possible use of this data is to give the script a secret that can be used to mount an encrypted filesystem (which you should unmount in the the "post-xfer exec" script).
The daemon must be at least version 3.2.1.
--list-only This option will cause the source files to be listed instead of transferred.  This option is inferred if there is a single source arg and no destination specified, so its main uses are: (1) to turn a copy command that includes a destination arg into a file- listing command, or (2) to be able to specify more than one source arg (note: be sure to include the destination).  Caution: keep in mind that a source arg with a wild-card is expanded by the shell into multiple args, so it is never safe to try to list such an arg without using this option. For example:
rsync -av --list-only foo* dest/
Starting with rsync 3.1.0, the sizes output by --list-only are affected by the --human-readable option.  By default they will contain digit separators, but higher levels of readability will output the sizes with unit suffixes.  Note also that the column width for the size output has increased from 11 to 14 characters for all human-readable levels.  Use --no-h if you want just digits in the sizes, and the old column width of 11 characters.
Compatibility note: when requesting a remote listing of files from an rsync that is version 2.6.3 or older, you may encounter an error if you ask for a non-recursive listing.  This is because a file listing implies the --dirs option w/o --recursive, and older rsyncs don't have that option.  To avoid this problem, either specify the --no-dirs option (if you don't need to expand a directory's content), or turn on recursion and exclude the content of subdirectories: -r --exclude='/*/*'.
--bwlimit=RATE This option allows you to specify the maximum transfer rate for the data sent over the socket, specified in units per second.  The RATE value can be suffixed with a string to indicate a size multiplier, and may be a fractional value (e.g. "--bwlimit=1.5m"). If no suffix is specified, the value will be assumed to be in units of 1024 bytes (as if "K" or "KiB" had been appended).  See the --max-size option for a description of all the available suffixes.  A value of 0 specifies no limit.
For backward-compatibility reasons, the rate limit will be rounded to the nearest KiB unit, so no rate smaller than 1024 bytes per second is possible.
Rsync writes data over the socket in blocks, and this option both limits the size of the blocks that rsync writes, and tries to keep the average transfer rate at the requested limit.  Some burstiness may be seen where rsync writes out a block of data and then sleeps to bring the average rate into compliance.
Due to the internal buffering of data, the --progress option may not be an accurate reflection on how fast the data is being sent. This is because some files can show up as being rapidly sent when the data is quickly buffered, while other can show up as very slow when the flushing of the output buffer occurs.  This may be fixed in a future version.
`--stop-after=MINS This option tells rsync to stop copying when the specified number of minutes has elapsed.
Rsync also accepts an earlier version of this option: --time- limit=MINS.
For maximal flexibility, rsync does not communicate this option to the remote rsync since it is usually enough that one side of the connection quits as specified.  This allows the option's use even when only one side of the connection supports it.  You can tell the remote side about the time limit using --remote-option (-M), should the need arise.
`--stop-at=y-m-dTh:m This option tells rsync to stop copying when the specified point in time has been reached. The date & time can be fully specified in a numeric format of year-month-dayThour:minute (e.g. 2000-12-31T23:59) in the local timezone.  You may choose to separate the date numbers using slashes instead of dashes.
The value can also be abbreviated in a variety of ways, such as specifying a 2-digit year and/or leaving off various values.  In all cases, the value will be taken to be the next possible point in time where the supplied information matches.  If the value specifies the current time or a past time, rsync exits with an error.
For example, "1-30" specifies the next January 30th (at midnight local time), "14:00" specifies the next 2 P.M., "1" specifies the next 1st of the month at midnight, "31" specifies the next month where we can stop on its 31st day, and ":59" specifies the next 59th minute after the hour.
For maximal flexibility, rsync does not communicate this option to the remote rsync since it is usually enough that one side of the connection quits as specified.  This allows the option's use even when only one side of the connection supports it.  You can tell the remote side about the time limit using --remote-option (-M), should the need arise.  Do keep in mind that the remote host may have a different default timezone than your local host.
--write-batch=FILE Record a file that can later be applied to another identical destination with --read-batch.  See the "BATCH MODE" section for details, and also the --only-write-batch option.
This option overrides the negotiated checksum & compress lists and always negotiates a choice based on old-school md5/md4/zlib choices.  If you want a more modern choice, use the --checksum- choice (--cc) and/or --compress-choice (--zc) options.
--only-write-batch=FILE Works like --write-batch, except that no updates are made on the destination system when creating the batch.  This lets you transport the changes to the destination system via some other means and then apply the changes via --read-batch.