title: How many files can I put in a directory?
body: <p>Does it matter how many files I keep in a single directory? If so, how many files in a directory is too many, and what are the impacts of having too many files? (This is on a Linux server.)</p>
  
  <p>Background: I have a photo album website, and every image uploaded is renamed to an 8-hex-digit id (say, a58f375c.jpg).  This is to avoid filename conflicts (if lots of "IMG0001.JPG" files are uploaded, for example).  The original filename and any useful metadata is stored in a database.  Right now, I have somewhere around 1500 files in the images directory.  This makes listing the files in the directory (through FTP or SSH client) take a few seconds.  But I can't see that it has any effect other than that.  In particular, there doesn't seem to be any impact on how quickly an image file is served to the user.</p>
  
  <p>I've thought about reducing the number of images by making 16 subdirectories: 0-9 and a-f.  Then I'd move the images into the subdirectories based on what the first hex digit of the filename was.  But I'm not sure that there's any reason to do so except for the occasional listing of the directory through FTP/SSH.</p>