title: Retrieving info of a very large directory
body: <p>I hit Linux's 32,000 subdirectory limit.  It caused problems with my PHP scripts and I don't want it to happen again.</p>
  
  <p>The simple solution is to have my PHP scripts check the current subdirectory count before trying to create another subdirectory.</p>
  
  <p>All ideas I've seen to perform such a check involve iterating over the entire directory and counting every folder.  Considering my concern is with very large directories, is there a better way to retrieve the number of files/folders it contains?</p>
  
  <p>Bonus question: is there also a non-iterative way to find the disk usage of a directory?</p>
  
  <p>Thanks in advance!
  Brian</p>