Re: reading a directory, first files the newest ones



On Oct 28, 2:04 am, "Jürgen Exner" <jurge...@xxxxxxxxxxx> wrote:
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

Yeah, it seems that this would be a solution.

.



Relevant Pages

  • Re: reading a directory, first files the newest ones
    ... I would like the newest files first, ... That is completely up to your OS and your file system. ... check the modification time with stat. ... or to also create a symbolic link in another directory ...
    (comp.lang.perl.misc)
  • Re: reading a directory, first files the newest ones
    ... jordilin wrote: ... To grab the files that are from two hours ago till now, ... process each file to check the modification time. ... while checks the oldest files first, it can take more than 10 minutes ...
    (comp.lang.perl.misc)
  • Re: reading a directory, first files the newest ones
    ... it loads the oldest ones first. ... I would like the newest files first, ... Taking into account that I am only interested ... check the modification time with stat. ...
    (comp.lang.perl.misc)
  • reading a directory, first files the newest ones
    ... When I read a huge directory with opendir, ... it loads the oldest ones first. ... I would like the newest files first, ... check the modification time with stat. ...
    (comp.lang.perl.misc)