Hello, just wondering, if you read a directory with, lets say 500,000+ files.....what happens? Will it take forever for your perl script to execute via web browser?

i intend to make a little script that sorts a directory by last modified, reads the files inside the directory, and then match all filenames with a certain "name" inside it. the filenames all have a certain format: name[date].txt  ex - bobby2006-05-08.txt

I basically need the last uploaded text file for each user homepages. So if they goto bobby's homepage, then they will see the last uploaded text file.

now i have problem that i ran into. i realized i can not rely on sorting the directory by last modified because these uploaded text files may be edited. so bobby2006-05-05.txt was edited today on 2006-05-08. however, bobby also uploaded a text file yesterday, meaning the file 2006-05-07.txt exists.

so if i was to rely on the systems last modified, it will show bobby2006-05-05.txt and not the most recent text that was uploaded yesterday (bobby2006-05-07.txt)

i'm still not that good with Perl and i've been trying to come up w/ a solution the last 3-4 hours and no luck. if anyone can help guide me to learn this then i will be very greatful.

cheers,
nick

2006-05-10 Retitled by planetscape, as per Monastery guidelines

( keep:5 edit:21 reap:0 )

Original title: 'reading a directory efficiency'


In reply to efficient way to find most recently modified 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.