News for hackers. Stuff that matters.
Re:Find is a beautiful tool by ordinary on Sunday July 24, 2011 @11:51AM (#2799600)
I've never quite understood the point of find's -exec option. What's wrong with a pipe?
Re:Find is a beautiful tool by CarolineW on Sunday July 24, 2011 @12:06PM (#2799636)
You can embed the name returned by find into the middle of lengthy commands by using the -exec option - it can be harder to do that with a pipe. It's also more resilient (in some cases) to filenames that have spaces in them.
Re:Find is a beautiful tool by arantius on Tuesday July 26, 2011 @12:16PM (#2808029)
Because it's a good/easy way to insert the file name into the _middle_ of the statement. For example:

  find . -name "*.gif" -exec convert "{}" "{}.png" \;
Will convert every GIF in the current directory (and its descendants) into a PNG, assuming imagemagick's convert is on your path. Is there a better way? Not that I know of.