Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: find "x" quantity newest files in a dir

by mr.nick (Chaplain)
on Jun 27, 2001 at 19:55 UTC ( [id://91952]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      my $dir="."; 
      my @files=(map { $_->[1] } 
                 sort { $a->[0] <=> $b->[0] } 
                 map { [ -M $_, $_ ] } 
                 glob("$dir/*"))[0..9];
    
  2. or download this
    my $dir="."; 
    my @files=(map { $_->[1] } 
    ...
               map { [ -M $_, $_ ] } 
               glob("$dir/*")); 
    splice (@files,-10);
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-24 05:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found