I would like to do something like:
find ./ -name "*.jpg" -nbresult 50 -exec cp {} /50randomsjpgfrommyharddrive
I can use head
and xargs
, but with -print0
, head
doesn't work any more.
GNU head has an option called -z for changing the line terminator to NUL, which can be used for this task as shown below.
find -name '*.jpg' -print0 \
| head -z -n 50 \
| xargs -0 cp -t /destination