unix question: files per directory

Andrew Klossner andrew at frip.wv.tek.com
Sat Apr 15 05:43:11 AEST 1989


Larry McVoy writes:

>> How many files can there be in a single UNIX directory ....

> If you are on a POSIX system, try this
> #include <unistd.h>
> dirsentries(dirpath)
> 	char *dirpath;
> {
> 	return pathconf(dirpath, _PC_LINK_MAX);
> }

This will tell you how many directories a directory can contain, not
how many files.  Adding a file to a directory does not increment its
link count.

  -=- Andrew Klossner   (uunet!tektronix!orca!frip!andrew)      [UUCP]
                        (andrew%frip.wv.tek.com at relay.cs.net)   [ARPA]



More information about the Comp.unix.questions mailing list