Let's say you have /a, /a/b, /a/c, and /x.  This:

  rsync /a /x

will create directories /x/a, /x/a/b, and /x/a/c.  On the other hand,
this:

  rsync /a/ /x

will create directories /x/b and /x/c.

Well, yeh, of course it will. Any code that does tree walks is going to behave the same way.

rsync /a /x

"in "/x", create "a" containing "/a" and everything under it"

Creates /x/a, /x/a/b, and /x/a/c.

rsync /a/. /x

"in "/x", create "." containing "/a/." and everything under it"

Creates /x/./b and /x/./c, which is /x/b and /x/c.

rsync /a/ /x

"in "/x", create "" containing "/a/" and everything under it"

Creates /x//b and /x//c, which is /x/b and /x/c. This works because UNIX ignores superfluous path separators, so "//" becomes "/" and the trailing "/" vanishes.

Presumably, this is to get around the problem where you want to copy all of the contents of a remote directory, but you can't use globbing, because
that's expanded locally, by the shell.

It's not to "get around" anything. It's just doing *exactly* what you told it to do.

rsync is worthy of hate, but not for this.

Reply via email to