gnu --target-dir, how to fake with rsync?

Martin Scharrer mailinglists at
Wed Oct 7 05:40:32 MDT 2009

Matt McCutchen-7 wrote:
> On Mon, 2009-10-05 at 12:47 -0400, Sanjeev Sharma wrote:
>> Is this in rsync and I just can't find it, or if not, is there a way
>> to fake this OR, third possibility, is anyone working to add it?
> The obvious approach is to use a wrapper script that moves its first
> argument to the end.
> [...]
> But if you're dynamically generating a list of source files, it might be
> appropriate to use --files-from rather than passing them as arguments.

I agree with both above points. However, I would also vote for adding such
an option to rsync.
This should not be to difficult and would come in handy.

About the mentioned use of the option --files-from:
Sanjeev's earlier example:

  find ./ -type file -mindepth 3 -print0 | xargs -r0 cp
--target-dir=/home/sam/stuff/otherstuff/morestuff -

can be adapted to rsync like this:

  rsync -0 --files-from=<(find ./ -mindepth 3 -type f -print0)

if you are using the BASH shell. Otherwise you have to write the output of
'find' into a temp file and use this for --files-from.

View this message in context:
Sent from the Samba - rsync mailing list archive at

More information about the rsync mailing list