Let's look at your rsync
command. You've omitted the options - which are important - so I've assumed you're using either -a
(--archive
) or -rt
(--recursive --times
), and I'll add -v
(--verbose
) for convenience too.
You're reading source files from this text file:
/a/b/c/f1
/a/b/c/f2
...
/a/b/c/d1
And you have this template, where each line from the text file is read into $lr
:
rsync $lr/ /z/$lr
Let's apply an equivalent of lines f1
and d1
to your templated command and see what we have:
mkdir -p /tmp/733765
cd /tmp/733765
mkdir -p a/b/c/d1
touch a/b/c/{f1,f2,d1/f3} z
rsync -av a/b/c/f1/ z/a/b/c/f1
rsync -av a/b/c/d1/ z/a/b/c/d1
Straightaway we can see that with the information shown to us, the file f1
will not get copied. Instead we get this error,
rsync: [sender] change_dir "/tmp/733765/a/b/c/f1" failed: Not a directory (20)
If you see f1
in the destination it must have been copied using some other solution, perhaps an earlier attempt at using rsync
.
Similarly, d1
won't get copied to the destination unless you have already created the directory path z/a/b/c
:
rsync: [Receiver] mkdir "/tmp/733765/z/a/b/c/d1" failed: No such file or directory (2)
mkdir -p z/a/b/c
rsync -av a/b/c/d1/ z/a/b/c/d1
created directory z/a/b/c/d1
./
f3
sent 122 bytes received 71 bytes 128.67 bytes/sec
There's something not right about the information in your question. If we ignore the rsync
command and concentrate on the source data set, you can use rsync
to read the source data set directly:
rsync --files-from /path/to/source_data_file -arv . z/
This may seem slightly strange because usually -a
includes -r
. However because we are using --files-from
and you have directories specified in the source data file we need to specify -r
explicitly to tell rsync
to recurse into the listed source directories. (Without this you'll only get named files copied.)