munge/unmunge one or more symlinks in‐place.
--copy‐dirlinks, -k
This option causes the sending side to treat a symlink to a di‐
rectory as though it were a real directory. This is useful if
you don’t want symlinks to non‐directories to be affected, as
they would be using --copy‐links.
Without this option, if the sending side has replaced a directory
with a symlink to a directory, the receiving side will delete
anything that is in the way of the new symlink, including a di‐
rectory hierarchy (as long as --force or --delete is in effect).
See also --keep‐dirlinks for an analogous option for the receiv‐
ing side.
--copy‐dirlinks applies to all symlinks to directories in the
source. If you want to follow only a few specified symlinks, a
trick you can use is to pass them as additional source args with
a trailing slash, using --relative to make the paths match up
right. For example:
rsync ‐r ‐‐relative src/./ src/./follow‐me/ dest/
This works because rsync calls lstat(2) on the source arg as
given, and the trailing slash makes lstat(2) follow the symlink,
giving rise to a directory in the file‐list which overrides the
symlink found during the scan of "src/./".
See the SYMBOLIC LINKS section for multi‐option info.
--keep‐dirlinks, -K
This option causes the receiving side to treat a symlink to a di‐
rectory as though it were a real directory, but only if it
matches a real directory from the sender. Without this option,
the receiver’s symlink would be deleted and replaced with a real
directory.
For example, suppose you transfer a directory "foo" that contains
a file "file", but "foo" is a symlink to directory "bar" on the
receiver. Without --keep‐dirlinks, the receiver deletes symlink
"foo", recreates it as a directory, and receives the file into
the new directory. With --keep‐dirlinks, the receiver keeps the
symlink and "file" ends up in "bar".
One note of caution: if you use --keep‐dirlinks, you must trust
all the symlinks in the copy or enable the --munge‐links option
on the receiving side! If it is possible for an untrusted user
to create their own symlink to any real directory, the user could
then (on a subsequent copy) replace the symlink with a real di‐
rectory and affect the content of whatever directory the symlink
references. For backup copies, you are better off using some‐
thing like a bind mount instead of a symlink to modify your re‐
ceiving hierarchy.
See also --copy‐dirlinks for an analogous option for the sending
side.
See the SYMBOLIC LINKS section for multi‐option info.
--hard‐links, -H
This tells rsync to look for hard‐linked files in the source and
link together the corresponding files on the destination. With‐
out this option, hard‐linked files in the source are treated as
though they were separate files.
This option does NOT necessarily ensure that the pattern of hard
links on the destination exactly matches that on the source.
Cases in which the destination may end up with extra hard links
include the following:
o If the destination contains extraneous hard‐links (more
linking than what is present in the source file list), the