Final arguments for xargs

xargs

Solution

`-I` option replaces occurrences of `replace-str` in the initial-arguments with names read from standard input.

For example:

find . -type f | xargs -I file cp file dest_dir

Should solve your problem.

More details in the following tutorial:

http://www.cyberciti.biz/faq/linux-unix-bsd-xargs-construct-argument-lists-utility/

Especially the part about `{}` as the argument list marker

Problem

I want to do something similar to this: ``` find . -type f | xargs cp dest_dir ``` But `xargs` will use `dest_dir` as initial argument, not as final argument. I would like to know: - Is it possible to specify final arguments to `xargs`? - Any other alternative to achieve the same result? EDIT A possible, but cumbersome alternative is this: ``` find . -type f | while read f ; do echo cp $f dest_dir ; done ``` I do not like this because dozens of `cp` processes will be started.

Original source

Related problems