It used to be that Unix file systems almost always implemented directories as just a linear array of entries. In such a system, having 10,000 files in a (single) directory could easily make a simple "ls" take many minutes to run and make even stat of a single file take quite a long time.

If you deployed a Unix system today, it is very likely that you'd get file systems that implement directories that include a tree-based index so that finding an entry for a named file is O(log $N) when there are $N files in the directory rather than O($N). So having 10,000 files in a directory would have roughly (some small multiple of) the performance of having 13 files in an old-style directory.

So, if you have a file system that was created two decades ago (and not recreated since), then you should be very worried about putting 10,000 files into a single directory. If you have a more modern file system, then it is likely that 10,000 files in a single directory is not a huge problem. Even if you are sure that you have a modern file system, you should still test the performance impact of your 10,000-file solution before committing to it.

- tye        


In reply to Re: is it possible to have too many files (history) by tye
in thread is it possible to have too many files by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.