On Windows, I am using use Net::SFTP::Foreign.
Sample code:
my $local_filesize = -s $ARCHIVEDIR."\\".$localfilename;
my $sftp = Net::SFTP::Foreign->new($sftp_server,user=>$sftp_userid, password=>$sftp_passwd, ssh_cmd =>$sftp_path) or die "\nCould not connect to the SFTP server ($!)";
$sftp->setcwd($sftp_ul_path) or die "\nCould not switch to the upload directory ($sftp_ul_path) on the SFTP server ($sftp->error)";
$sftp->put($ARCHIVEDIR."\\".$localfilename,$remotefilename) or die "Could not upload $localfilename to the SFTP server ($sftp->error)";
my $ls = $sftp->ls();
foreach (@$ls){
if ($_->{filename} eq $localfilename){
my $remote_filesize = $_->{a}{size};
if ($remote_filesize eq $local_filesize && POSIX::strftime("%m-%d-%Y",localtime($_->{a}{mtime})) eq strftime('%m-%d-%Y', localtime(time))){
$result = "File sent successfully";
}else{
$result = "File was not sent successfully (".$remote_filesize." -> ".$local_filesize." && ".POSIX::strftime("%m-%d-%Y",localtime($_->{a}{mtime}))." -> ".strftime('%m-%d-%Y', localtime(time)).")";
}
}
}
$sftp->disconnect;
From: perl...@listserv.ActiveState.com [mailto:perl...@listserv.ActiveState.com] On Behalf Of Schwartz, Peter W
Sent: Monday, October 27, 2014 11:44 AM
To: perl...@listserv.ActiveState.com
Subject: SFTP
I'm trying to locate an SFTP install for Windows (32-bit) but I can't seem to find anything in the PPM for some reason. Does anyone have any recommendations on how to get this for Windows?
________________________________
Peter W Schwartz | Vice President | IB Tech Market | Investment Bank | J.P. Morgan | Floor 4, 115 S Jefferson Road, Bldg D, Whippany, NJ | T: +1(973) 793-7407 | pete...@jpmorgan.com<mailto:pete...@jpmorgan.com> | jpmorgan.com
This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email.
_______________________________________________
Perl-Win32-Users mailing list
Perl...@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs