On 13Jul2020 11:25, Patrick O'Callaghan <pocallaghan(a)gmail.com> wrote:
On Mon, 2020-07-13 at 19:20 +1000, Cameron Simpson wrote:
> Make two directories the same:
>
> rsync path/to/A/ other/path/to/B/
>
> (no bare names after the final '/').
I don't think the trailing slash matters on the destination directory.
At least that's not what the man page seems to say (and none of the
examples there use a trailing slash on a destination).
That is... interesting.
I expected, and I had thought years of personal rsync usage had bourne
this out, that if there was no B directory, then
rsync -ia A B
would make a "B" the same shape as "A". Like "cp -a A B",
when B does
not exist.
But it doesn't, it creates B and puts an "A" inside it.
Still this makes an unwanted subdirectory (unwanted to me, most of the
time). I still prefer the both-src-and-dst-exist approach an to use a
trailing slash:
rsync -ia A/ B/
which just replicates the contents of A inside B.
So I almost always want to go "make these 2 things the same", not "make
a copy of this _inside_ that".
Cheers,
Cameron Simpson <cs(a)cskk.id.au>