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

Re: Re: File list by date

by snax (Hermit)
on Dec 21, 2000 at 21:05 UTC ( [id://47826]=note: print w/replies, xml ) Need Help??


in reply to Re: File list by date
in thread File list by date

Careful! Checking the description of readdir it says one must either chdir or prepend the $dir if you want to do filetests.
foreach (sort {-M qq($dir/$b) <=> -M qq($dir/$a)} readdir(ROOT)) { print $_, $/; }
for example.

Replies are listed 'Best First'.
Re: Re: Re: File list by date
by nkpgmartin (Sexton) on May 03, 2001 at 18:36 UTC
    Using this method (snax), is there a way to only list files that are one hour old, or two hours old, etc.?
      Nope :)

      For OS ways to do this, the *nix answer is to use find and sort. Perl is definitely a reasonable way to go when you want this kind of response.

      I usually pipe ls -lt through head -N to just see the more recent files, though, and vary N as necessary.

      But then again, I'm lazy :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2024-04-24 23:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found