in reply to Re^4: Continuously polling multiple directories for file transfer?
in thread Continuously polling multiple directories for file transfer?

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!