Note that there are some explanatory texts on larger screens.

plurals
  1. POThousands of images, how should I organize the directory structure? (linux)
    text
    copied!<p>I am getting thousands of pictures uploaded by thousands of users on my Linux server, which is hosted by 1and1.com (I believe they use CentOS, but am unsure of the version). This is a language agnostic question, however, for your reference, I am using PHP.</p> <p>My first thought was to just dump them all in the same directory, however, I remember a little while ago, there was a limit to how many files or directories could be dropped in a directory.</p> <p>My second thought was to partition the files inside directories based on the users email address (as it is what I am using for the user name anyhow) but I don't want to run into the limit for directories in a directory....</p> <p>Anyhow, for images from user@domain.com, I was going to do this:</p> <pre><code>/images/domain.com/user/images... </code></pre> <p>Is this smart to do, what if thousands of users have say 'gmail' perhaps I could even go deeper, like this</p> <pre><code>/images/domain.com/[first letter of user name]/user/images... </code></pre> <p>so for mike@gmail.com it would be...</p> <pre><code>/images/domain.com/m/mike/images... </code></pre> <p>Is this a bad approach? What is everyone else doing? I don't want to run into problems with too many directories also...</p> <hr> <p>Related:</p> <ul> <li><a href="https://stackoverflow.com/questions/466521/how-many-files-in-a-directory-is-too-many">How many files in a directory is too many?</a></li> <li><a href="https://stackoverflow.com/questions/315459/optimum-web-folder-structure-for-250-000-images">Optimum web folder structure for ~250,000 images</a></li> <li><a href="https://stackoverflow.com/questions/191845/how-to-store-images-in-your-filesystem">How to store images in your filesystem</a></li> <li><a href="https://stackoverflow.com/questions/671260/tips-for-managing-a-large-number-of-files">Tips for managing a large number of files?</a></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload