Bug 13321 - Rsync --copy-dest issue
Summary: Rsync --copy-dest issue
Status: RESOLVED WORKSFORME
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.1.3
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-07 09:53 UTC by Anatoly Penkov
Modified: 2020-06-13 19:18 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anatoly Penkov 2018-03-07 09:53:46 UTC
Please help me to clarify my situation.

Remote (destination) server has a directory /data/data/ and includes 5 OLD files: data/apu1.part1.rar data/apu1.part2.rar data/apu1.part3.rar data/apu1.part4.rar data/apu1.part5.rar

Remote (destination) server has a directory /data/cache/data and includes 5 NEW files: /data/cache/data/apu1.part1.rar /data/cache/data/apu1.part2.rar /data/cache/data/apu1.part3.rar /data/cache/data/apu1.part4.rar /data/cache/data/apu1.part5.rar

Local (source) host includes 5 NEW files with the same names: data/apu1.part1.rar data/apu1.part2.rar data/apu1.part3.rar data/apu1.part4.rar data/apu1.part5.rar

I try to use Rsync with -copy--dest option not to transfer all NEW files but to use them from /data/cache/data directory. Unfortunately I have no success. New files can be used from /data/cache/data ONLY if I transfer files to the new empty directory. Could someone help to make it working? I hope there is some needed key or option. Thanks in advance.

Transfer log https://pastebin.com/Zm8GBAEM
Comment 1 Anatoly Penkov 2018-03-07 12:24:02 UTC
rsync -rlDi -z -t --no-h --out-format="%t %i %n %L" --copy-dest=/data/cache --stats --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r --delay-updates --partial --delete-after --force --ignore-errors /data/data root@l-rel-dnl.urg.avp.ru:/data
Comment 2 Dave Gordon 2018-03-08 08:51:22 UTC
Looks right :)

Another way to say it would be using a relative path:

$ rsync -rlDi -z -t --no-h --out-format="%t %i %n %L" --stats --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r --delay-updates --partial --delete-after --force --ignore-errors --copy-dest=../cache/data/ /data/data/ root@l-rel-dnl.urg.avp.ru:/data/data/

Here I've used trailing slashes on source and destination paths, implying that we transfer the *contents* of the source directory (rather than the directory itself) into the destination directory; and a relative path for the --copy-dest, so you can see how it's evaluated relative to the root of the transfer on the destination server.

.Dave.