Re: sorting directories

2002-11-12 Thread John W. Krahn
"John W. Krahn" wrote: > > Sukrit K Mehra wrote: > > > > Hi listers, > > Hello, > > > While doing this --> > > > > @files = readdir(Favorites); > > > > i get an unsorted list in @files. What i desire is directories first and > > then files. Using sort function would sort by ascii value and sort

Re: sorting directories

2002-11-12 Thread John W. Krahn
Sukrit K Mehra wrote: > > Hi listers, Hello, > While doing this --> > > @files = readdir(Favorites); > > i get an unsorted list in @files. What i desire is directories first and > then files. Using sort function would sort by ascii value and sort > by_name and such won't work too. Please sugge

RE: sorting directories

2002-11-12 Thread Timothy Johnson
Here's one way: my @dirs = (); my @files = (); opendir(DIR,"/"); my @entries = readdir(DIR); @entries = sort @entries; foreach(@entries){ if(-d "/".$_){ push @dirs,$_; }else{ push @files,$_; } } foreach(@dirs,@files){ print $_."\n"; } -Original Message- From: Sukrit K Me

Re: sorting directories [correction]

2002-11-12 Thread Paul
--- Sukrit K Mehra <[EMAIL PROTECTED]> wrote: > Hi listers, > While doing this --> > @files = readdir(Favorites); > i get an unsorted list in @files. What i desire is directories first > and then files. Using sort function would sort by ascii value and sort > by_name and such won't work too. Ple

Re: sorting directories

2002-11-12 Thread Paul
--- Sukrit K Mehra <[EMAIL PROTECTED]> wrote: > Hi listers, > While doing this --> > @files = readdir(Favorites); > i get an unsorted list in @files. What i desire is directories first > and then files. Using sort function would sort by ascii value and sort > by_name and such won't work too. Ple