[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: faster version of find (for -exec)?

From: Bernhard Voelker
Subject: Re: faster version of find (for -exec)?
Date: Sat, 19 Jul 2014 12:24:06 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 07/19/2014 05:20 AM, Peng Yu wrote:
> I'm wondering if there is a faster version of `find` (may be in other
> languages, such as python or perl).
> `-exec` of `find` calls for an external command, which is slow.

What exactly is slow with -exec? Please post examples.
It's very likely that it's a confusion on your side how find(1)
works with -exec.

Especially note that an invocation like

  find some/where -exec some/prog '{}' \;

will execute 1 "some/prog" process per file found, while

  find some/where -exec some/prog '{}' +

will execute "some/prog" processes with as much files as parameters
as possible by the current environment, thus dramatically reducing
the need to spawn new processes.

  $ find . -exec echo process '{}' \;
  process .
  process ./c
  process ./b
  process ./a

  $ find . -exec echo process '{}' +
  process . ./c ./b ./a

Did you hit this one?

Have a nice day,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]