Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Getting a list of files in a directory sorted by date

by explorer (Chaplain)
on Apr 07, 2006 at 16:33 UTC ( [id://541902]=note: print w/replies, xml ) Need Help??


in reply to Getting a list of files in a directory sorted by date

opendir(DIR,$logdir); foreach( readdir(DIR) ) { next unless /\w/; $date{ -M $_ } = $_; # Store modification's time } closedir DIR; foreach ( sort { $a <=> $b } keys %date ) { print $date{$_} # Show ordered files }

Replies are listed 'Best First'.
Re^2: Getting a list of files in a directory sorted by date
by Ovid (Cardinal) on Apr 07, 2006 at 16:46 UTC

    What happens when you have two files with the same mtime?

    Cheers,
    Ovid

    New address of my CGI Course.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-03-29 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found