perl脚本:FTP获得服务器文件

perl脚本:FTP获得服务器文件,第1张

概述该脚本采用FTP方式从批量服务器上获得文件。 #!perl#Author: HC#Date: 2012/10/22use Net::FTP;use Cwd;$localFile = getcwd()."/log/";if (!-e $localFile){ mkdir $localFile, 0755 or warn "Cannot make $localFile direct

该脚本采用FTP方式从批量服务器上获得文件。

#!perl#Author: HC#Date: 2012/10/22use Net::FTP;use Cwd;$localfile = getcwd()."/log/";if (!-e $localfile){	mkdir $localfile,0755 or warn "Cannot make $localfile directorty:$!";}if (!open SERVER_INFO,getcwd()."/ftpserver.txt"){	dIE "Ftp server information file can not be found:$!";}while (<SERVER_INFO>){	@fIElds = split;	$servername = $fIElds[0];	$server = $fIElds[1];	$port = $fIElds[2];	$user = $fIElds[3];	$pwd  = $fIElds[4];	$remotefile = $fIElds[5];		$ftp = Net::FTP->new($server,Port=>$port,DeBUG=>0,Timeout=>1000)		or dIE "Cannot connect:$!";	$ftp->login($user,$pwd)		or dIE "Could not login:$!";	$ftp->get($remotefile,$localfile.$servername.".log")		or dIE "Could not get remote file:$remotefile:$!";	print $servername."Get file successful.\n";	$ftp->quit;}print "Press <Enter> to continue...";<>;system "start $localfile";
总结

以上是内存溢出为你收集整理的perl脚本:FTP获得服务器文件全部内容,希望文章能够帮你解决perl脚本:FTP获得服务器文件所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1293514.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存