From: Julian Cowley (no email)
Date: Sun Apr 01 2007 - 04:12:30 EDT
On Fri, 30 Mar 2007, Victor Duchovni wrote:
> On Fri, Mar 30, 2007 at 10:02:37AM -0700, Eric Frazier wrote:
>
> > > sudo find /var/spool/postfix/deferred -type f -print | wc -l
>
> This has to stat every file and so incurs a lot of I/O, by far faster on
> systems with leaf-directory optimization is:
>
> sudo find /var/spool/postfix/deferred/. ! -name . ! -name '?' -print | wc -l
That's pretty nice. Unless I'm missing something, looks like it can
be further reduced to:
sudo find /var/spool/postfix/deferred/. ! -name '?' -print | wc -l
At least it works on my system. YMMV.
We have a script at work that does something similar to this (which
also depends on leaf-directory optimization). It gets around doing
stat() by listing the queue directories directly on the command
line, but it then has to subtract the directory count to get the
right answer. I like Victor's version much better since it is simple
and elegant.
|
|
|