>> > rsync -a rhk /back/
>> >
>> > That's what I would use to create the /back/rhk directory during the copy.
>> > The obvious alternative would be:
>> >
>> > mkdir /back/rhk
>> > cd /rhk
>> > rsync -a . /back/rhk/
>> >
>>
>> i'm curiuous: why use cd/mkdir at all?
>>
>> afaik both, cp and rsync work just fine without them:
>>
>> rsync -a /rhk /back/
>
> I find it much easier to get the commands right if I cd to the source
> directory first. With long and complicated pathnames, it can be
> easy to get confused about exactly which directory component(s) will be
> copied over, and which will only be traversed.
FWIW, to avoid having to guess if `rsync my/foo your/bar` will end up
creating a `your/bar/foo` or not, I pretty much always pass to `rsync`
file names that end in `/.`, as in:
rsync -a my/foo/. your/bar/.
I find it much more robust than relying the subtle differences between
when file names end in `/` and when they don't, or when the target dir
already exists or not (which tend to bite me what I have to interrupt
an `rsync` and restart it again, since the target will usually exist
for the second run but not for the first).
It does require my creating `your/bar` manually beforehand, tho.
=== Stefan