Herunterladen von Dateien via FTP

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]

runplex.pl
sub ftp_load {
   my ($server, $dir, @files) = @_;
   my $ftp = Net::FTP->new($server);
   unless (defined($ftp)) {
      msg("Unable to setup FTP connection to $server");
      return 0;
   }
   unless ($ftp->login("anonymous", "$cmdname@")) {
      msg("Unable to login on FTP server $server");
      $ftp->quit;
      return 0;
   }
   unless ($ftp->cwd($dir)) {
      msg("Unable to cd $dir on FTP server $server");
      $ftp->quit;
      return 0;
   }
   foreach my $file (@files) {
      msg("Loading $file...");
      unless ($ftp->get($file)) {
         msg("Loading $file... FAILED"); $ftp->quit;
         return 0;
      }
      chmod(0755, $file) if $file =~ /\.pl$/;
      msg("Loading $file... OK");
   }
   msg("Loading finished successfully");
   $ftp->quit;
   return 1;
}

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]
Copyright © 1996, 1998, 1999, 2000 Andreas Borchert, in HTML konvertiert am 07.02.2000