Not quite - I meant just to look for the .complete file was there, so you'd upload file_2009-02-12_1234.dat and then upload file_2009-12-1234.dat.complete once the first upload was done. You may even want to put a small amount of metadata in the .complete file, an md5 of the real file, for example. So the upload is something like
my $id = '2009-02-12-1234'; my $filename = "file-$id.dat"; my $local_file = "$src_dir/$filename"; # upload 'real' file $ftp->put ( $local_file, $filename ) || die "can't upload: $!"; # it completed ok - upload the completion marker $ftp->put ( $dummy_file, "$filename.complete" );
And the watcher:
foreach my $file (@files) { # Only look for the 'upload complete' marker files next unless $file =~ /^(.*)\.complete$/; # extract the name of the 'real' file my $base_name = $1; # insert into db pqinsert( $file_dir . $base_name ); # move real file into archive dir move( $file_dir . $base_name, $archive_dir . $base_name ) || die "can't move: to $archive_dir - $!"; # remove the 'complete' marker file unlink($file) || die "can't unlink $file - $!" }
HTH!

In reply to Re^5: Continuously polling multiple directories for file transfer? by foobie
in thread Continuously polling multiple directories for file transfer? by pktrain

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.