I have seen find commands as follows, and wonder on the difference between them.
find . -exec COMMAND {} \;
find . -exec COMMAND {} \+
find . -exec COMMAND {} +
I have seen find commands as follows, and wonder on the difference between them.
find . -exec COMMAND {} \;
find . -exec COMMAND {} \+
find . -exec COMMAND {} +
There are two syntaxes for find exec.
find . -exec [cmd] {} \;
{} Is a placeholder for the result found by find
; Says that for each found result, the command cmd is executed once with the found result.
It is executed like this: cmd result1; cmd result2; ...; cmd result N
find . -exec [cmd] {} \+
{} Is a placeholder for the result found by find
+ Says that for all found results, the command cmd is executed with all the found results.
It is executed like this: cmd result1 result2 ... result N
when we should use find exec ; other than +
The tool run by -exec does not accept multiple files as an argument
Running the tool on so many files at once might use up too much memory
We want to start getting some results as soon as possible, even though it will take more time to get all the results