[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: copy directory tree, mapping to new owners



12 sept. 2021, 08:53 de l0f4r0@tuta.io:

> 12 sept. 2021, 03:45 de richard@walnut.gen.nz:
>
>> # actually not necessary? rsync will create it
>> mkdir -p mysite_test/doc_root
>>
> You can make a simple test to know that but I would say that rsync doesn't create your destination "root" directory (the one you specify on the command line) unless `--mkpath` is used.
>
Actually, I've just did some tests and it appears that rsync creates the destination folder if its parent already exists and if you have the right permissions.

For example ("my" and "dest" don't exist yet):

rsync -a src/ dest => "dest" is created

rsync -a src/ my/dest => error, "my" and "dest" don't exist (and are not created then)

rsync --mkpath -a src/ my/dest => "my" and "dest" are created

l0f4r0


Reply to: