Number of files in a directory?

Martin Weitzel martin at mwtech.UUCP
Fri May 24 08:14:52 AEST 1991


In article <1991May19.111727.18637 at virtech.uucp> cpcahil at virtech.uucp (Conor P. Cahill) writes:
:mikeh at fsd.cpsc.ucalgary.ca (Michael Hoffos) writes:
:>[...]
:>how can you get the number of
:>files that are in a directory? 
[...]
:If on a v7 style filesystem you can get the size of the directory and
:divide it by 16, but that only works on a single directory,  is non-portable
:and definately doesn't work for BSD style file systems.

And it will not work if you have deleted some files from the directory,
as directories don't shrink once they have been big (except you have a
special utility to compress them).
-- 
Martin Weitzel, email: martin at mwtech.UUCP, voice: 49-(0)6151-6 56 83



More information about the Comp.unix.questions mailing list