> Am 23.01.2026 um 16:36 schrieb Stan Marsh <[email protected]>:
>
> My basic problem is that when I am doing a "mass copy" - that is copying a
> large directory
> structure from one place to another, most of the time I want behavior #1 from
> the list
> below, but, occasionally, I want behavior #2.
>
> 1) If the original directory is, say, /foo/bar/beezle and my current
> directory is
> /home/wow, then I want the contents of /foo/bar/beezle to be copied into
> /home/wow. E.g.,
> if there is a file called /foo/bar/beezle/zowie, the new file will be:
> /home/wow/zowie.
>
> 2) Same setup as before, now I want it to create a new directory "beezle"
> under /home/wow
> and then put all the copied stuff there. So, in the example above, the new
> file would be:
> /home/wow/beezle/zowie.
>
> Now, the two programs that I use to do these sorts of copies are "cp" and
> "rsync". I'm
> pretty sure that "rsync" does one thing if you do something like:
>
> $ rsync -avxH /foo/bar/beezle .
>
> And the other if you do:
>
> $ rsync -avxH /foo/bar/beezle/ .
>
> But I can never remember which is which, so I usually end up
> trial-and-erroring it until I
> get it right.
For rsync, I'm always using the "/." sxntax both for the source and the target.
By tjat it's clear to me that it deals with all the content of either side.
$ rsync -HACaxi /foo/bar/breezle/. /hpme/wow/breezle/.
> But, here's the thing, "cp" (with -a) seems to do the same thing with either
> syntax, which
> is behavior #2 from the above list (which is usually, IME, the wrong thing).
>
> Interestingly, after a little bit of trial-and-error, I found that:
>
> $ cp -a /foo/bar/beezle/. .
>
> does the right thing. But it seems like there should be a cleaner solution.
> Is there?
>
> Note, incidentally, that another method would be:
>
> $ cp -a /foo/bar/beezle/* .
>
> But that would miss the "dot files", wouldn't it?
Besides what others will reply, maybe it's worth looking at the -t option of
cp(1).
Have a nice day,
Berny