Re: reading directories

From: Web Surfer (raisin_at_delete-this-trash.mts.net)
Date: 01/14/04


Date: Wed, 14 Jan 2004 13:23:51 -0600


[This followup was posted to comp.lang.perl.misc]

>, robin@csf.edu says...
> When you readdir will it sort the files of into the array ie:
> @a = readdir (DIR);
> by the file modified or by the name?
>
> Thanks.
>
> --
> peace,
> Robin
> --------------
> robin@csf.edu
> Please CC a copy of your message to me.
> --------------

The output from readdir() is not roted.

You can sort it by doing something like this :

     @a = sort readdir (DIR);



Relevant Pages

  • Re: reading directories
    ... "Robin" wrote in message ... > When you readdir will it sort the files of into the array ie: ...
    (comp.lang.perl.misc)
  • Re: Sorting the items in a directory
    ... I used your solution Jeff and it's working a treat. ... Rob Dixon wrote: ... I want to sort it by non-directories first and then directories, with a secondary sort in alphabetical order. ... I don't want to rely on the alphabetical ordering from the readdir as ...
    (perl.beginners)
  • map woes
    ... sort ... The readdir and grep work as I expect. ... messing this up? ...
    (comp.lang.perl.misc)
  • Re: reading directories
    ... > When you readdir will it sort the files of into the array ie: ... You want them sorted, you sort them. ... See "perldoc -f stat" for sorting by ...
    (comp.lang.perl.misc)
  • Re: map woes
    ... sort ... The readdir and grep work as I expect. ... The result of the map is a ...
    (comp.lang.perl.misc)