A few more manpage clarifications.

This commit is contained in:
Wayne Davison
2022-10-15 16:56:16 -07:00
parent d76cabe54f
commit 35ecec972a

View File

@@ -154,35 +154,40 @@ rsync daemon by leaving off the module name:
## COPYING A SINGLE FILE
Rsync has special handling for a copy of a single file that allows for the name
to be changed on the destination. The rules for this are:
Rsync has the ability to customize the destination file's name when copying a
single item. The rules for this are:
- The transfer list must consist of a single file (with no parent directory in
the transfer)
- The transfer list must consist of a single item (either a file or an empty
directory)
- The final element of the destination path must not exist as a directory
- The destination path must not have been specified with a trailing slash
Under those circumstances, rsync will set the name of the destination file to
the last element of the destination path.
Under those circumstances, rsync will set the name of the destination's single
item to the last element of the destination path.
For example, the following will copy the foo.c file as bar.c in the "dest" dir
(assuming that bar.c isn't a directory):
> rsync -ai src/foo.c dest/bar.c
This rule might accidentally bite you if you unknowingly copy a single file and
specify a destination dir that doesn't exist (without a trailing slash). For
example:
This rule might accidentally bite you if you unknowingly copy a single item and
specify a destination dir that doesn't exist (without using a trailing slash).
For example:
> rsync -ai src/*.c dest/dir
If the `*.c` only matched one file and dest/dir did not yet exist, then rsync
would rename the single .c file with the name "dir" in "dest". To prevent
this, it is safest to specify a destination path with a trailing slash when you
want it to be treated as a directory:
If the `*.c` only matched one file and dest/dir does not yet exist, then rsync
copies the single .c file to the name "dir" in "dest". To prevent this, it is
safest to specify a destination path with a trailing slash when you want it to
be treated as a directory:
> rsync -ai src/*.c dest/dir/
If you want to copy a **non-empty** directory to a different name, specify the
source path with a trailing slash:
> rsync -ai foo/ bar
## SORTED TRANSFER ORDER
Rsync always sorts the specified filenames into its internal transfer list.
@@ -1154,6 +1159,15 @@ expand it.
FILE](#) section for full details on how rsync decides if a final
destination path element is a directory or not.
If you would like the newly-created destination dirs to match the dirs on
the sending side, you should be using [`--relative`](#opt) (`-R`) instead
of `--mkpath`. For instance, the following two commands result in the same
destination tree, but it is only the second command that ensures that the
"some/extra/path" elements match the dirs on the sending side:
> rsync -ai --mkpath host:some/extra/path/*.c some/extra/path/
> rsync -aiR host:some/extra/path/*.c ./
0. `--links`, `-l`
Add symlinks to the transferred files instead of noisily ignoring them with