#!/usr/bin/perl
use Net::FTP;
use IO::File;
unless($filesToPut[0]){
open(OUTFILE,">>/home/pa/telecentre/log/pa_tc.log");
print OUTFILE "- No senior citizen data files(zip) found on $Day/$RealMonth/$RealYear $Hour:$Minute:$Second\n";
close(OUTFILE);
exit;
}
### Start connection to www.abc.com ###
print "Connecting to www.abc.com .....";
if(not defined($ftp = Net::FTP->new("www.abc.com", Debug => 0, Timeout => 300)))
{
print "failed to connect to server !\n";
exit;
}
print "\nVerifying user.....";
if(!$ftp->login("abc","abc"))
{
$ftp->quit();
die "failed to login\n";
exit;
}
print "Connected to TeleCentre Server !\n";
if(not $ftp->binary())
{
$ftp->quit();
print "failed to set to binary mode\n";
exit;
}
print "Getting files from abc server.....\n\n";
# from here, how do I check if the directory contain any .bin file(s), only transfer .bin file. If yes, it will get back all the .bin file to local server !
Thanks !
use Net::FTP;
use IO::File;
unless($filesToPut[0]){
open(OUTFILE,">>/home/pa/telecentre/log/pa_tc.log");
print OUTFILE "- No senior citizen data files(zip) found on $Day/$RealMonth/$RealYear $Hour:$Minute:$Second\n";
close(OUTFILE);
exit;
}
### Start connection to www.abc.com ###
print "Connecting to www.abc.com .....";
if(not defined($ftp = Net::FTP->new("www.abc.com", Debug => 0, Timeout => 300)))
{
print "failed to connect to server !\n";
exit;
}
print "\nVerifying user.....";
if(!$ftp->login("abc","abc"))
{
$ftp->quit();
die "failed to login\n";
exit;
}
print "Connected to TeleCentre Server !\n";
if(not $ftp->binary())
{
$ftp->quit();
print "failed to set to binary mode\n";
exit;
}
print "Getting files from abc server.....\n\n";
# from here, how do I check if the directory contain any .bin file(s), only transfer .bin file. If yes, it will get back all the .bin file to local server !
Thanks !