Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: getting next 5 files according to hour

by bimleshsharma (Beadle)
on Feb 21, 2012 at 13:06 UTC ( #955299=note: print w/ replies, xml ) Need Help??


in reply to Re: getting next 5 files according to hour
in thread getting next 5 files according to hour

Here is code for the same. You need to change path to where that files are..

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++; }


Comment on Re^2: getting next 5 files according to hour
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://955299]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2014-12-21 02:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (101 votes), past polls