Morning,
Is perl able to ftp multiple files in a single session. Currently I have a perl script that ftps the file to another server but it does one at a time open/closing a session which the 2nd server is unable to handle. Thanks in advance.
======================================================
opendir(DIR, $edioldtmp_dir);
while ( defined($file = readdir(DIR)) ) {
next if $file =~ /^\.\.?/;
$ftpsub_rc=ftpsub();
if ( $ftpsub_rc == 0 ) { unlink( $edioldtmp_dir . "/" . $file),
print LOG "$now->File: $file\n" };
}
};
sub ftpsub {
use Net::FTP;
my $ftp;
$ftp = Net::FTP->new("sample.com", Port => 21, Debug => 1) || return(1);
$ftp->login("loginid", "password") || return(1);
$ftp->cwd ("INBOUND/EDI") || return(1);
$ftp ->put ($edioldtmp_dir . "/" . $file) || return(1);
$ftp->quit() || return(1);
return (0);
};
Is perl able to ftp multiple files in a single session. Currently I have a perl script that ftps the file to another server but it does one at a time open/closing a session which the 2nd server is unable to handle. Thanks in advance.
======================================================
opendir(DIR, $edioldtmp_dir);
while ( defined($file = readdir(DIR)) ) {
next if $file =~ /^\.\.?/;
$ftpsub_rc=ftpsub();
if ( $ftpsub_rc == 0 ) { unlink( $edioldtmp_dir . "/" . $file),
print LOG "$now->File: $file\n" };
}
};
sub ftpsub {
use Net::FTP;
my $ftp;
$ftp = Net::FTP->new("sample.com", Port => 21, Debug => 1) || return(1);
$ftp->login("loginid", "password") || return(1);
$ftp->cwd ("INBOUND/EDI") || return(1);
$ftp ->put ($edioldtmp_dir . "/" . $file) || return(1);
$ftp->quit() || return(1);
return (0);
};