我有一个通过ftp目录列出文件的代码,但我希望只能列出20分钟以上的文件。
use Net::FTP;
#Global variables that i am not going to list down..
my $pattern = 'fi*';
my @remote_files;
my $ftp = Net::FTP->new($host) or die "Error connecting to $host: $@";
$ftp->login($username,$password) or die "Login failed: ", $ftp->message;
$ftp->cwd($ftpdir) or die "Can't go to $ftpdir: ", $ftp->message;
print $ftp->pwd();
@remote_files = $ftp->ls($pattern);
foreach my $file (@remote_files){
print "file: $file\n";
}
$ftp->quit or die "Error closing ftp connection: ", $ftp->message;发布于 2014-08-06 03:50:17
nvm我自己解决了这个问题我用
$ftp->mdtm($file); 获取文件的时间,并将其与当前时间减20分钟进行比较。
https://stackoverflow.com/questions/25151287
复制相似问题