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.
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.
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....
Anyhow, for images from [email protected], I was going to do this:
/images/domain.com/user/images...
Is this smart to do, what if thousands of users have say 'gmail' perhaps I could even go deeper, like this
/images/domain.com/[first letter of user name]/user/images...
so for [email protected] it would be...
/images/domain.com/m/mike/images...
Is this a bad approach? What is everyone else doing? I don't want to run into problems with too many directories also...
Related: