linebacker has asked for the wisdom of the Perl Monks concerning the following question:
Contents of lastupdate.txt after a run1 #!/usr/bin/perl -w 2 #use strict; 3 use Net::FTP; 4 my $host = 'www.ftp.com'; 5 my $user = 'anonymous'; 6 my $pass = 'updatepuller@ftp.com'; 7 my $remote_dir = '/pub/antivirus/NAV/signatures'; 8 my $destination_dir= "current-sig"; 9 $ftp = Net::FTP->new($host, Debug => 1); 10 $ftp->login($user,$pass); 11 my @listing = $ftp->ls("$remote_dir"); 12 $lflag = 0; 13 if(-e "./lastupdate.txt") { 14 open(LASTUPDATE,"./lastupdate.txt"); 15 @lupd = (<LASTUPDATE>); 16 close(LASTUPDATE); 17 $lflag = 1; 18 } else { 19 $lupd = ""; 20 } 21 foreach $line (@listing) { 22 chomp($line); 23 $lline = lc($line); 24 if ($lline =~ "x86.exe") { 25 foreach $haveit (@lupd) { 26 chomp($haveit); 27 if (($lflag == 0) || ($haveit ne $line)) { 28 $ftp->type("I"); 29 $ftp->get("$line"); 30 } 31 } 32 $newupdate .= "$line\n"; 33 } 34 } 35 $ftp->quit; 36 #@lupd = split(/\n/,$newupdate); 37 @nupd = ($newupdate); 38 open(NEWUPDATE,">>./lastupdate.txt"); 39 print NEWUPDATE @nupd; 40 close(NEWUPDATE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Anti-Virus Signature Updates
by rincew (Novice) on Jul 08, 2002 at 21:08 UTC | |
by linebacker (Scribe) on Jul 08, 2002 at 21:41 UTC | |
by rincew (Novice) on Jul 09, 2002 at 08:32 UTC | |
by linebacker (Scribe) on Jul 10, 2002 at 14:22 UTC | |
|
Re: Anti-Virus Signature Updates
by fruiture (Curate) on Jul 08, 2002 at 20:34 UTC | |
|
Re: Anti-Virus Signature Updates
by Anonymous Monk on Jul 09, 2002 at 00:14 UTC | |
by Anonymous Monk on Jul 09, 2002 at 00:28 UTC |