Using find and xargs

In regular linux or unix you can recursively find the files in a subdirectory and apply some utility with arguments on them using xargs as,

find <dir> -type f | xargs <utilitiy> <args>

If the filenames in <dir> have spaces, quotation marks, or other characters in their filenames that make xargs barf, then you can use the following.

find <dir> -type f print0 | xargs -0 <utility> <args>

That should totally work–unless you’re on SunOS, then you have to do,

find <dir> -type f -exec <utility> <args> {} +

It looks crazy, I know, but that’s the honest truth.