> A trailing / on a source directory name means
> "copy the contents of this directory".
> Without a trailing slash it means "copy the directory".
>
>I can't help but think that perhaps we need to change the UI by, for
>example, adding a switch called --copy-directory-contents, instead
>of depending on whether or not there's a trailing slash there.
Hear Hear.
The existing behaviour is a useful shorthand
when using rsync from the command line,
but scripts must have clumsy logic
to ensure they do or don't have the slash.
Otherwise unexpected behaviour is passed on to the script user.
I'd suggest a pair of mutually exclusive flags that override the slash.
Perhaps: -k --copy-directory-contents and -K --copy-directory
Mnemonic: -k kontents -K (perl regex like) NOT k
Or: --copy-directory=directory and --copy-directory=contents
This doesn't break anything and makes scripting rsync easier and clearer.
michaelj