- 论坛徽章:
- 0
|
#!/usr/bin/perl
#use strict;
use Net::FTP;
use File::Find;
my $uploadpath = "/data01"; #上传的路径
my $datapath = "/xddr/timeing/bak/201610/20161001"; #要上传的文件的本地路径
my $host="134.1.169.120";
# get file list to be upload
find( \&filter, $datapath);
my $ftp=Net::FTP->new($host,Passive => 1) or die "cannot connect to ftp server $!";
$ftp->login("test","test");
$ftp->binary and print "set type to binary\n";
$ftp->cwd($uploadpath);
foreach $file (@filelist) {
my $result = $ftp->put($file);
}
$ftp->quit();
@filelist=();
sub filter{
push @filelist, $File::Find::name if -f ;
}
这是我最新改的,之前只是将put的文件print到一个文件,更改的地方也都是print的语句;
就是传到一半,没反应了,最后一次是传到一半突然很慢了,而且传过去的文件都是0字节;
目录大概有15w个文件,刚刚有中断了,传了6w多个文件,停住了。
不知道哪里有问题。
|
|