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.
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? > > > 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 --The obvious approach is to use a wrapper script that moves its first argument to the end, like this: #!/bin/bash dest="$1" shift exec rsync "$@" "$dest" 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. -- Matt
On Mon, 05 Oct 2009 12:47:54 -0400, Sanjeev Sharma wrote:> They added the option to get cp & mv working well with xargsWhat happened to the -I option to xargs? This permits one to do the replacement anywhere on the command line being repeated. - Andrew
Seemingly Similar Threads
- missing foreign key fields in scaffold views
- Install problem on Solaris 9
- [: Re: [fwd] CVS: ogg123 rocks! vcut no so much so... (from: wayfarer42@postmaster.co.uk)]
- [PATCH] Make appliance-building work on systems with default library search paths differing from the appliance's
- KLdiv produces NA. Why?