title: Many files in one directory?
body: <p>I develop some PHP project on Linux platform. Are there any disadvantages of putting several thousand images (files) in one directory? This is closed set which won't grow. The alternative would be to separate this files using directory structure based on some ID (this way there would be let's say only 100 in one directory).</p>
  
  <p>I ask this question, because often I see such separation when I look at images URLs on different sites. You can see that directory separation is done in such way, that no more then several hundreds images are in one directory. </p>
  
  <p>What would I gain by not putting several thousand files (of not growing set) in one directory but separating them in groups of e.g. 100? Is it worth complicating things?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <ul>
  <li>There won't be any programmatic iteration over files in a directory (just a direct access to an image by it's filename)</li>
  <li>I want to emphasize that the image set is closed. It's less then 5000 images, and that is it.</li>
  <li>There is no logical categorization of this images </li>
  <li>Human access/browse is not required</li>
  <li>Images have unique filenames</li>
  <li>OS: Debian/Linux 2.6.26-2-686, Filesystem: ext3</li>
  </ul>
  
  <p><strong>VALUABLE INFORMATION FROM THE ANSWERS:</strong></p>
  
  <p>Why separate many files to different directories:</p>
  
  <ul>
  <li>"32k files limit per directory when using ext3 over nfs"</li>
  <li>performance reason (access speed) [but for several thousand files it is difficult to say if it's worth, without measuring ]</li>
  </ul>