weidagang2046的专栏

物格而后知致
随笔 - 8, 文章 - 409, 评论 - 101, 引用 - 0
数据加载中……

自动FTP脚本

use strict;
use Net::FTP;

my $ftp = Net::FTP->new($HOST) or die "Cannot connect to $HOST: $@";
$ftp->login($USER,$PASS) or die "Cannot login ", $ftp->message;
$ftp->ascii;
$ftp->cwd($PATH);

foreach my $file (@file_list) {
    
my $remote_file = $file.'.txt';
    
my $local_file = $LOCAL_PATH."/$remote_file";
    
if ($ftp->size($remote_file)) {
        
$ftp->get($remote_file,$local_file) or die "get failed ", $ftp->message;
    }
}

$ftp->quit;

posted on 2006-03-11 00:04 weidagang2046 阅读(608) 评论(0)  编辑  收藏 所属分类: Perl


只有注册用户登录后才能发表评论。


网站导航: