Perl 访问FTP


#ftp
#ljl

#!/usr/bin/perl
use strict;
use Net::FTP;

my $user = "anonymous";
my $passwd = "chinaunix@";
my $host = "ftp.freebsd.org";

my $ftp = Net::FTP->new("$host", Debug =>0)
or die "Can't connect to $host: $@\n";

$ftp->login("$user","$passwd")
or die "Can't login\n", $ftp->message;

$ftp->cwd("/pub/FreeBSD/doc/")
or die "Can't change dir\n", $ftp->message;

$ftp->get("README")
or die "get failed\n", $ftp->message;

$ftp->quit;
exit 0;
FTP下载
相关文章
相关标签/搜索