File::Find
时间:2010-10-21 来源:snowtty
#!/usr/bin/perl
use strict;
use File::Copy;
use File::Find;
use POSIX qw( strftime); my $time = strftime("%Y-%m-%d %H:%M:%S", localtime(time));
my $date = strftime("%Y-%m-%d", localtime(time)); my $logfolder = "/logs/udms/cmback_2_02/";
find(\&filehandler, "$logfolder");
my @file; sub filehandler {
my $file = $File::Find::name;
if (-f $file) {
if($file=~/udsvr.log.$date/){
push @file,$file;
}
}}
foreach (@file){
print "$_\n";
}
use File::Copy;
use File::Find;
use POSIX qw( strftime); my $time = strftime("%Y-%m-%d %H:%M:%S", localtime(time));
my $date = strftime("%Y-%m-%d", localtime(time)); my $logfolder = "/logs/udms/cmback_2_02/";
find(\&filehandler, "$logfolder");
my @file; sub filehandler {
my $file = $File::Find::name;
if (-f $file) {
if($file=~/udsvr.log.$date/){
push @file,$file;
}
}}
foreach (@file){
print "$_\n";
}
相关阅读 更多 +