Re: sorting directory contents

From: Date: Mon, 11 Sep 2000 08:15:53 +0000
Subject: Re: sorting directory contents
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16130@lists.php.net to get a copy of this message
On Sun, 10 Sep 2000 17:49:29 -0700, Wizaerd (wizaerd@wizaerd.com) wrote: >I'm building a script that reads an image directory, outputting the >name of >the image, the dimensions of the image as well as it's size. It's >using >opendir() and readdir(), but readdir() doesn't return the directory >back in >any particular order. I'm not storing the results to an array >because >ultimately there could be thousands of images, and I'd like to save >the >memory overhead of building then sorting such a large array. > >So is there anyway to just read the results of an opendir() that is >sorted >by filename? if you have imagemagick installed you could do something like: passthru("identify -ping *.gif *.jpg | sort | cut -f1,2,4 -d' '"); no array, but there will be overhead no matter how you do it. - Mark

« previous php.general (#16130) next »