Why does this rsync line not work?

Matt McCutchen hashproduct+rsync at gmail.com
Thu Dec 7 01:06:51 GMT 2006


On 12/6/06, Larry Alkoff <labradley at mindspring.com> wrote:
> This command works from the Kterm command line or in a script:
> rsync -nuv     /mnt/kinda2/home/lba/dl/*   /home/lba/dl
> and a list of the files to be updated appears on the screen.
>
> But this line (without a tailing * in source) does not work:
> rsync -nuv     /mnt/kinda2/home/lba/dl/   /home/lba/dl

You need -r, --recursive to make rsync recurse inside the source
directory.  The first command worked because the shell expanded
/mnt/kinda2/home/lba/dl/* into a list of the individual files inside
the source directory before rsync saw it, so rsync didn't need to
perform any recursion itself.

> The man pages says that a trailing / on the source will cause rsync to
> copy the _contents_ of the destination directory.  I do that in the
> second case but it does not work.

That remark in the man page is easy to misinterpret.  It was meant to
refer only to where the source directory is placed on the destination,
not to whether rsync recursively copies its contents.  Maybe the man
page should say something like this: "A source directory specified
without a trailing slash is mapped to a directory of the same name
inside the destination directory, but a source directory with a
trailing slash is mapped to the destination directory itself."

Matt


More information about the rsync mailing list