Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using the following structure to save the images that users are uploading for their items:

  • Images
    • User_dir1
      • Item_dir1
        • Picture_file1
        • Picture_file2
    • User_dir2
      • Item_dir2
        • Picture_file3
      • Item_dir3
        • Picture_file4

Can I go on with this if I am going to have thousants of users and hundrets of items per user? Talking about performance will the Linux dedicated server have trouble in the future?


share|improve this question
This site is probably not the best place to ask this question. I would suggest ServerFault. – Walter Nov 11 '10 at 12:03
up vote 2 down vote accepted

Well, how much time does it take to create a thousand folders over the course of say a month? I would argue not a lot. It would take a lot of time if you were regularly removing and creating folders, but it seems to me the only files that will be changed regularly will be the picture files themselves (or at worst, the folders themselves initially as they won't exist at first, but that will diminish over time), which is the same as if you had lumped everything in a single folder to begin with.

Obviously keep an eye on space and state of defragmentation of your disk, but with a little maintenance, I wouldn't expect a lot of difficulty in your idea.

share|improve this answer

Unless you'll need more than 65534 folders per directory you should be okay (apparently this is the maximum for NTFS)

share|improve this answer
you get slowdown on some tasks way before that. any time you suspect you'll have thousands of items, you should split directories – Javier Nov 11 '10 at 15:24
Thats true I was stating the absolute maximum – billy.bob Nov 11 '10 at 16:42

It's most likely much better than putting all files into one large directory; some file systems do not really like having tens of thousands of files in on directory.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.