linux-l: Automatisches FTP
Jens Dreger
jens.dreger at physik.fu-berlin.de
Do Jul 27 20:01:11 CEST 2000
On Thu, Jul 27, 2000 at 05:37:23PM +0000, Dr. Bernd Freistedt wrote:
>
> > wget ftp://username:password@ftp.server.de/pfad/zur/datei
>
> Gibt's eigentlich so etwas wie ein "wput"?
Moment...
--------------8<---------------------
#!/usr/local/bin/perl -w
#
# wput, version -0.001
# (c) Jens Dreger
#
use Net::FTP;
if(!@ARGV) {
print "usage: wput ftp://username:password\@server/path/to/file\n";
exit(0);
}
my ($user, $passwd, $server, $path, $file) =
$ARGV[0] =~ m|ftp://([^:]+):([^@]+)@([^/]+)/(.*?)/?([^/]+)$|;
my $ftp = Net::FTP->new($server) || die "bitte was ?";
$ftp->login($user,$passwd) || die "could not log into server";
if($path) {$ftp->cwd($path) || die "no such directory: $path"; }
$ftp->put($file) || die "could not put file";
$ftp->quit;
print "Es sieht so aus, als haette mal was funktioniert...\n";
--------------8<---------------------
Jetzt ja ;-)
Gruss,
Jens.
PS: man nehme...
ftp://rpmfind.net/linux/powertools/CPAN/CPAN_rev.2/i386/perl-libnet-1.0606-2.i386.rpm
Mehr Informationen über die Mailingliste linux-l