[plug] find -exec

Russell Steicke r.steicke at bom.gov.au
Tue Oct 25 08:12:24 WST 2005


On Mon, Oct 24, 2005 at 11:32:45PM +0800, Lyndon Maydwell wrote:
> > find dir/ -type d | xargs chmod 755
> > find dir/ -not -type d | xargs chmod 644
> 
> Seems like it would do the trick, but there are 20gb of files to sort
> through here, what would be the best (fastest) way?

  find blah | xargs stuff

is almost always quicker than

  find blah -exec stuff '{}'

because in the first way, xargs will grab as many arguments as the
kernel will allow on your system, and run stuff the minimum number of
times required, with lots of args.  In the second way, find will run
stuff once for each find result.



-- 
Russell Steicke

-- Fortune says:
According to the latest official figures, 43% of all statistics are
totally worthless.



More information about the plug mailing list