Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Fastest way to count # of files?



Bart Schaefer wrote on Thu, Sep 08, 2016 at 18:09:58 -0700:
> On Sep 8,  1:00pm, Bart Schaefer wrote:
> }
> } This assumes that nlink for a directory is the number of files it
> } contains plus "." and "..".
> 
> Accuracy of this seems to vary by filesystem type, so probably not
> a viable solution.

nlink for a directory $d is usually the two plus number of subdirectories
$d has; it's unrelated to the number of files in $d.  (A directory is
hard linked from its parent, from itself, and from each subdirectory of
itself, but not from files in it.)



Messages sorted by: Reverse Date, Date, Thread, Author