Dear monks
I have an issue with my boss I am working on a program that sends text file by FTP, and he constantly is saying that : What happens when the connection is lost and the file on the server is zero???, I really never seen something like that, so he continues to say that I need to use sockets, which in my poor life as a programmer sounds creepy and rare, does someone knows how to verify that the file I am sending by ftp gets to the server complete? I thought on the size of the file but is that posible???
again this is part of what I have done so far:
this is the part where I send the file by FTP:
my @fileList = glob "m*.*";
foreach my $file (@fileList) {
chomp($file);
if ( $file =~ /.+\.\d{1,}/ ) { # one or more characters, a '.' foll
+owed by one or more digits
print STDOUT "<Nombre valido del Archivo> " . $file . "\n";
my $server = "xxx.xx.xx.xx";
my $username = "xxxxx";
my $pass = "xxxxxxxxxx";
my $ftp;
print "Connecting to $server..";
# Set up connection
$ftp = Net::FTP->new( $server, Passive => 1, Debug => 0 ) o
+r die $@;
print "..authenticating..";
# Log in...
$ftp->login( $username, $pass ) or die $ftp->message;
print "..done!\n";
$ftp->cwd('Envio') or die $ftp->message;
print $ftp->pwd (), "\n";
$ftp->ascii();
$ftp->put("$file") or die $ftp->message;
print "Logging out..";
#or die $ftp->message;
$ftp->quit;
print "..done!\n";
}
else {
print STDOUT "<Nombre Invalido del Archivo> " . $file . "\n";
}
}
for (@transferFileList) {
print "$_\n";
system ("del",$_);
}
}
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.