my $hour = (localtime)[2]; my $nu=0; if($hour eq 0) {$hour= 23;} else {$hour--;} my @files1 = <dir path of you file>; i.e. <C:\\WINDOWS\\*.log>; while($nu < 6) { if($hour>23) {$hour = 0;} my $hr= sprintf("%02d",$hour); foreach my $file (@files1) { if($file =~ /_($hr)\.txt/ ) {print $file . "\n";} } $hour++; $nu++; }
In reply to Re^2: getting next 5 files according to hour
by bimleshsharma
in thread getting next 5 files according to hour
by shekarkcb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |