vickycanada:

Generally, you'd just check whether they all exist, then do your thing. For example:

my $XXX = ... from somewhere ...; if (-e "$srcDir/alphat.$XXX.zip" and -e "$srcDir/numerict.$XXX.zip" an +d -e "$srcDir/updatet.$XXX.zip") { # all files are found, so go do some work } else { # Not all files are present yet. }

Generally, that's the easy part. For a real task, files won't always show up simultaneously. So you'd have to scan your input directory for files and extract a list of XXX values from them. You can use that list in a for loop with the above code to process any group where all three XXX parts exist.

The harder bit comes where you need to allow some time to pass before declaring an error and causing someone to go in and debug the situation. To do so, I'd suggest tracking the current time when you find a new file, and then in your chunk where you don't have all files present, you can compare the current time with the time that the file was discovered, and if enough time has elapsed, then emit a warning with the files that are missing. You'll also likely want to stash away those files so they don't keep warning you. But that's the fun of making a production system.

Update: Changed -E to -e (thanks for catching that, choroba!)

...roboticus

When your only tool is a hammer, all problems look like your thumb.


In reply to Re^2: Check multiple file names exist in directory and create another trigger file after existing files processed by roboticus
in thread Check multiple file names exist in directory and create another trigger file after existing files processed by vickycanada

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.