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下載


發佈了70 篇原創文章 · 獲贊 13 · 訪問量 21萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章