Ftp using perl and getting the files based upon a configuration file
I have copied all the file names into one file called "sdk_link.txt" and
I am reading each file name from this and then copying to my local PC:
use strict;
use warnings;
use Net::FTP;
use File::Copy;
$Login = "root";
$Pwd = "shroot";
$ftpHost = "tcspava";
$ftpFolder = "/home/tcspava";
$ftp=Net::FTP->new($ftpHost,Timeout=>100);
if ($ftp)
{
print $ftp->message;
}
$ftp->login($Login,$Pwd);
print $ftp->message;
$ftp->cwd($ftpFolder);
print $ftp->message;
open FILE,"sdk_link.txt" or die $!;
while($test=<FILE>)
{ chomp($test);
#Copy the file
copy("$test","/testing");
} $ftp->quit;
0 comments: