It is currently Tue, 25 Apr 2017 06:14:19 GMT

Author Message
 number of entries in directory

Hi guys,

     Is there a short cut for me to tell how many entries in a direcotyr
       witout traversing the acutal directory ?


 Fri, 26 Jan 2001 03:00:00 GMT   
 number of entries in directory
In article <6qo03r$>, (Hany Morcos (CS)) writes:

Unfortunately not.  Probably the best you can do is

    DIR *dp;
    size_t n = 0;

    dp = opendir (".");
    if (dp)
        while (readdir (dp))

    /* Now N holds the number of entries (including "." and ".."). */

Note that you can find the number of entries in a directory which are
themselves directories by using the link count.  Many (most?)
implementations of find use this trick to reduce the number of stat()s
needed in a directory.

Aaron Crane   <>   <URL:>

 Sat, 27 Jan 2001 03:00:00 GMT   
   [ 2 post ] 

Similar Threads

1. Number of entries in ninode table of vxfs

2. Number of entries in utmpx/wtmpx

3. How to get /dev entry from id number

4. Controlling number of entries on a print queue under Solaris2.4

5. Number of entries in Linux partition array / Redboot-style FIS table

6. too many entries too many entries too mant entries in the KDE menu

7. free_one_pmd: bad directory entry

8. LDAP - how do I create his directory entry???

9. size column for a directory entry in ls

10. Directory Entries

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software