Forum Moderators: coopster

Message Too Old, No Replies

How to list just directories?

How to list just directories?

         

freestyle

8:20 pm on Jul 19, 2005 (gmt 0)



Hi everyone,

i currently use this code to generate a list of jpgs within a folder:

$handle=opendir('path to directory');

$pics=array();
$count=0;

while (($file = readdir($handle))!==false) {

if (substr($file,-4) == ".jpg" ¦¦ substr($file,-4) == ".JPG"){

$pics[$count] = $file;
$count++;

}
}
closedir($handle);

i was wondering if it can be modified to generate a list of directories within a directory?

any help would be appreciated.

jatar_k

8:24 pm on Jul 19, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



what about using is_dir [php.net]