unix question: files per directory

Larry McVoy lm at snafu.Sun.COM
Wed Apr 12 05:43:49 AEST 1989


>In article <24110 at beta.lanl.gov> dxxb at beta.lanl.gov (David W. Barts) writes:
>>How many files can there be in a single UNIX directory ....
>>I realize that as directories get bigger, they slow down, but
>>how much?  Just what IS the maximum directory size?

If you are on a POSIX system, try this

#include <unistd.h>

dirsentries(dirpath)
	char *dirpath;
{
	return pathconf(dirpath, _PC_LINK_MAX);
}

Unfortunately, on systems that allow entries up to the file size, pathconf
will almost certainly return -1 (indicating "infinity").  But machines with
a hard limit should give you that limit.

Larry McVoy, Lachman Associates.			...!sun!lm or lm at sun.com



More information about the Comp.unix.wizards mailing list