Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: File list by date

by kilinrax (Deacon)
on Dec 21, 2000 at 18:29 UTC ( [id://47785]=note: print w/replies, xml ) Need Help??


in reply to File list by date

Use 'sort' with a file test operator ('-M' for modification time, '-A' for access time, et.c.).
The following script this works fine on my linux box; apologies if it doesn't port to Windows ;-}
#!/usr/bin/perl -w use strict; chdir '/winD' or die "Could not change directory: $!"; opendir DIR, '.' or die "Could not open directory: $!"; my @files = readdir DIR; closedir DIR; my @sortedfiles = sort { -M $a <=> -M $b } @files; $, = "\n"; print @sortedfiles;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-19 00:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found