.的回答:http://liucheng.name/852/ Perl:用Net::FTP来上传下载文件
Posted on 31 七月 2009 by 柳城 ,阅读 1,103 在Perl中,使用模块Net::FTP来使用FTP服务,一般的使用步骤如下:
更多有关标准的Net::FTP模块的应用,可以参考PerlDoc里的说明:perldoc Net::FTP #使用模块Net::FTP use Net::FTP; #创建新的FTP连接 $ftp = Net::FTP->new ( "ftp##", #ftp地址 Timeout => 30 ) or die "Could not connect.\n"; #登录用的用户名和密码 $username = 'name'; $password = 'passwd'; #登录到FTP服务器 $ftp->login($username,$password) or die "Could not login.\n"; #切换目录 $ftp->cwd('/www/entrez'); #指定远程的文件和本地的文件 $remotefile = "emotefile"; $localfile = "localfile"; #使用get/put方法下载/上传文件 $ftp->put($localfile,$remotefile) or die "Could not put remotefile:$remotefile\n"; #$ftp->get($remotefile,$localfile) or die "Could not put localfile:$localfile\n"; #退出FTP服务器 $ftp->quit;.的回答:http://liucheng.name/852/ Perl:用Net::FTP来上传下载文件
Posted on 31 七月 2009 by 柳城 ,阅读 1,103 在Perl中,使用模块Net::FTP来使用FTP服务,一般的使用步骤如下:
更多有关标准的Net::FTP模块的应用,可以参考PerlDoc里的说明:perldoc Net::FTP #使用模块Net::FTP use Net::FTP; #创建新的FTP连接 $ftp = Net::FTP->new ( "ftp##", #ftp地址 Timeout => 30 ) or die "Could not connect.\n"; #登录用的用户名和密码 $username = 'name'; $password = 'passwd'; #登录到FTP服务器 $ftp->login($username,$password) or die "Could not login.\n"; #切换目录 $ftp->cwd('/www/entrez'); #指定远程的文件和本地的文件 $remotefile = "emotefile"; $localfile = "localfile"; #使用get/put方法下载/上传文件 $ftp->put($localfile,$remotefile) or die "Could not put remotefile:$remotefile\n"; #$ftp->get($remotefile,$localfile) or die "Could not put localfile:$localfile\n"; #退出FTP服务器 $ftp->quit; |