2 ms·
xargs? Here is an example from the man page: >For example, the following command will copy the list of >files and directories which start with > a
by Tyr42 14y ago
xargs?
Here is an example from the man page:
>For example, the following command will copy the list of >files and directories which start with
> an uppercase letter in the current directory >to destdir:
/bin/ls -1d [A-Z]* | xargs -J % cp -rp % destdir
You can use this with find really nicely.
find . -name somefile.txt -print0 | xargs -0 -J % cp -rp % destdir
Note the -print0 and -0 flags (zero). This will use a null byte as a separator instead of spaces to avoid failing on files with spaces in their names.