It is easy to detect the arrival of a file, the hard part is to verify that the file transfer has completed or not. There are several methods to do this. Three methods on top of my head:

Method 1 - two step process. Step 1 to wait for a file, step 2 to check the size of the file and wait for it to stop growing/changing for, say, 5 minutes to ensure that the transfer is complete. This method is dangerous, because the connection could drop halfway during processing, but your process would not know and carry on with a half completed file. The result is not pleasent.

Method 2 - let the remote process send a trigger file after the file is transmitted successfully. Your process will wait for the trigger file, say, with the name of the file you are waiting for, plus the .trig extension. The problem is that remote systems may not be able to send the trigger file (3rd party application).

Method 3 - use a self verifying file format, like a zip file. The zip file carries CRC for file content validation.


In reply to Re: auto detection of file upload on ftp server by Roger
in thread auto detection of file upload on ftp server 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.