Re: possible optimization



On Mon, 2006-02-27 at 18:59 +0100, Alexander Larsson wrote:
> > You don't even need the names.  stat("/some/directory") will give you
> > the number of entries in the directory in the st_nlink field.  An empty
> > directory has st_nlink=2 because of "." and "..".  This is useful for
> > non-deep counts.
> 
> Hmm. This is interesting. How portable is this amongst filesystems? (Of
> course, it'll only work for file:/// files.)

Crap, I lied :)  st_nlink for a directory gives you the number of
*subdirectories*, including . and ..

This is what we used in GMC to know when to display an expander in the
folder tree.

Sorry for the confusion,

  Federico




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