Here is the simpler, faster and most portable way to do it :
find $1 -exec touch {} +
Note the +
ending syntax. Unlike the more popular \;
exec
ending syntax, +
is packing arguments the same way xargs
does.
Compared to the often suggested find ... | xargs ...
, this find
only solution is more efficient because:
- a single process is handling whole task
- no data piping is involved
- no extra processing associated with the "\0" hack is required.
Being POSIX compliant, it also works with most if not all current find
implementations unlike find -print0
and xargs -0
which are both GNUisms.