By the time tar has finished the files must be there. Are you running tar (to extract the files) at the same time as the script? If you are, it would be difficult to see when the file actually gets there, the only good way I can think of is to give the output of tar xv to the perl script. So I recommend you to run the tar first and do the copying after the tar process has exitted unless it's absolutely neccessarry to do otherwise.

If you are doing the copying after untarring, I can't really think of any reason why the extracted files won't show up (unless the untarring and the copying are done on two different machines with some network file system). In that case, I'd check for some tricky errors, like newlines at the end of filenames (I often fall in this trap).

Update. I didn't really answer your actual question. The short answer is no. It would be possible to wait for a file to appear, but you'd have to wait until the contents of the file are written completely by tar, as surely you don't want to copy a parital file. This is almost impossible to do without doing something with the tar process.


In reply to Re: Archive::Tar then File::Copy? by ambrus
in thread Archive::Tar then File::Copy? by Elijah

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.