Das Herunterladen von Dateien

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

runplex.pl
sub load {
   my ($dir, @files) = @_;
   msg("Loading source files...");
   my $basedir = $ENV{'HOME'} . "/.$cmdname";
   unless (-d $basedir) {
      msg("Creating $basedir...");
      mkdir($basedir, 0777) ||
         die "$cmdname: Unable to create $basedir\n";
   }
   my $tmpdir = "$basedir/$$";
   if (-d $tmpdir) {
      my $suffix = "a";
      while (-d "$tmpdir$suffix") {
         msg("$tmpdir$suffix");
         ++ $suffix;
      }
      $tmpdir .= $suffix;
   }
   msg("Creating $tmpdir...");
   mkdir($tmpdir, 0777) ||
      die "$cmdname: Unable to create $tmpdir\n";
   chdir($tmpdir) ||
      die "$cmdname: Unable to chdir to $tmpdir\n";

   msg("Fetching files from $dir");
   if ($dir =~ m{^ftp://(.*?)/(.*)$}) {
      my ($server, $dir) = ($1, $2);
      ftp_load($server, $dir, @files) ||
         die "$cmdname: Unable to load files\n";
   } else {
      die "$cmdname: unknown dir: $dir\n";
   }
}

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]
Copyright © 1996 - 2003 Andreas Borchert, in HTML konvertiert am 01.10.2003