You need xargs replacement to do it that way..

sheepeatingtaz, Omahn’s method seems fine for a one-off. The problem with resiak’s suggestion is that you need text after the data that xargs would put in. One way to do it would be:


$ cd ~/fonts
$ find . -type f -iname '*.ttf' -print0 | xargs -I{} -0 cp {} ~/.fonts/

The -I flag tells it to replace the string “{}” with the data from its standard input, so it allows you to put more of the command after the data.

However you also find that -I implies -L1 — only do one command at a time! So this is actually no better than the simpler find that Omahn suggested.

Looking at the manpage for xargs it is possible to force it to do more by setting -L yourself. So you could say -L100 for example. But I don’t know if find’s automatic abilities to not exceed the maximum command length are still in force then.

In all honesty I’d most likely use Omahn’s simple find command to do them one at a time, if this is just a one-off.

3 thoughts on “You need xargs replacement to do it that way..

  1. Well this got me thinking, and as a result, I discovered the –target-directory (-t) option of cp, which I never knew existed, so you can write it the other way around (destination first) and use xargs as ‘normal’.

    find ~/fonts/ -type f -iname ‘*.ttf’ -print0 | xargs -0 cp –target-directory=~/.fonts/

Leave a Reply

Your email address will not be published. Required fields are marked *