use strict; 22 use warnings; 23 use Data::Dumper; 24 use Net::FTP; 25 26 my $ftp; 27 my $newerr; 28 my @files; 29 my @ERRORS; 30 my $name; 31 my $res; 32 my @radius; 33 my @radius_alt1; 34 35 $ftp = Net::FTP->new("HOST", Debug => 0) or die "Cannot connect to some.host.name: $@"; 36 $ftp->login("USER",'PWD') or die "Cannot login ", $ftp->message; 37 $ftp->cwd("/var/log/radius") or die "Cannot change working directory ", $ftp->message; 38 $newerr=0; 39 @files=$ftp->dir or $newerr=1; 40 push @ERRORS, "Can't get file list on $_ $!\n" if $newerr; 41 $ftp->quit if $newerr; 42 next if $newerr; 43 print "Got list $_\n"; 44 print Dumper(@files); #schau dir an welche files du im array hast 45 $ftp->binary(); 46 foreach (@files) { 47 #ToDo: nur log file und files mit timestamp <= 14 Tagen herunterladen 48 #command ist vermutlich Systemabhängig 49 $ftp->get($_); 50 } 51 $ftp->quit; 52 $res = system("gzip.exe -d radius.log-20110405.gz') "); 53 open (IN,"; 55 close IN; 56 open (IN,"; 58 close IN; 59 open(OUT,">radius.log"); 60 print OUT "@radius"; 61 print OUT "@radius_alt1"; 62 close(OUT);