Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: File list by date

by kilinrax (Deacon)
on Dec 21, 2000 at 18:29 UTC ( #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? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2022-05-25 04:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (84 votes). Check out past polls.

    Notices?