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

Sanjeev Sharma throwit1 at gmail.com
Mon Oct 5 10:47:54 MDT 2009


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?


For those who've never used this option - for the GNU cp & mv type
commands they have the
--target-dir="dir"

option.  It lets you put the destination directory as the first
argument to cp and mv instead of the last argument.

They added the option to get cp & mv working well with xargs  for
stuff like this:

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

then xargs puts all of the files found by find after the --



Before I learned about this argument I used to do stuff like the "-i"
and "-n" options
find ./ -type file -mindepth 3 -print0 | xargs -r0 -iTARGET -n1 cp
TARGET  /home/sam/stuff/otherstuff/morestuff

Which limits xargs to doing one file per invocation.


More information about the rsync mailing list