Re: reading a directory, first files the newest ones



jordilin wrote:
On Oct 28, 1:36 am, Gunnar Hjalmarsson <nore...@xxxxxxxxx> wrote:
You may want to use grep() to assign to an array the files you are
interested in.

my @files = grep -M $_ <= 2/24, readdir DIR;

To grab the files that are from two hours ago till now, I have to
process each file to check the modification time.

Yes. That is what the -M does.

Obviously, if the
while checks the oldest files first, it can take more than 10 minutes
to arrive for those files I am interested in.

That is exactly why Gunnar suggest not to use a while() loop but grep() in
the first place.

jue


.



Relevant Pages


Quantcast