in reply to Updating files over multiple servers


# A sample program

# Modules used
use Net::FTP;
use File::Copy;
Net::FTP;

my $error,$ftp;

#Connection to the test server
$ftp = Net::FTP->new("testserver.vago.com", Timeout => 75, Debug => 0, BlockSize => 1024);

if (!$ftp) {
print "Could not connect to testserver.vago.com\n";
}
else
{
print "Successfull Connection to the server\n";
}


#Login to the testserver.vago.com
ftp->login("testftp","123qwe") || print "Could not login to the server\n";
print "Successfull login to the server\n";


#Get files from the server and then delete them
$ftp->cwd("/home/testftp/cat/rat");
@dirlist = $ftp->ls();
foreach $file (@dirlist) {
$ftp->get($file,"/home/testftp/cat/rat/$file") ||
print "Could not get the files";
notify("Got the file $file from server to the local machine\n");
print LOG "$tds $file\n";
$ftp->delete($file) || print "Could not delete $file in server";
}
  • Comment on Re: Updating files over multiple servers

Replies are listed 'Best First'.
Re^2: Updating files over multiple servers
by lwicks (Friar) on Sep 27, 2007 at 11:30 UTC
    One question on this pretty darn clear example. When you are printing to the LOG, what is $tds ? Cheers

    Kia Kaha, Kia Toa, Kia Manawanui!
    Be Strong, Be Brave, Be perservering!

      I would guess that $tds is a "time/date-stamp", but given that code snippet, I don't know where it would be coming from. I suppose you might want to add a line like:
      my $tds = scalar localtime;