RE: list files in a diretory
| From: | Tim Ward | Date: | Tue, 10 Apr 2001 13:39:03 +0000 |
| Subject: | RE: list files in a diretory | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-48023@lists.php.net to get a copy of this message | ||
function sitemap($ddPath)
{ $dhandle = opendir($ddPath);
echo("<ul>");
while ($ddFile = readdir($dhandle))
{ if ($ddFile == "." or $ddFile == "..") continue; // trap .
and ..
echo("<li>".$ddFile . "</li>");
if (is_dir($ddPath . $ddFile)) sitemap($ddPath . $ddFile .
"/");
};
closedir($dhandle);
echo("</ul>");
};
just call it by passing in the path to the directory you want to list and
it'll give you a full listing below that point
Tim Ward
Senior Systems Engineer
Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html
> -----Original Message-----
> From: Augusto Cesar Castoldi [mailto:castoldi@inf.ufsc.br]
> Sent: 09 April 2001 17:06
> To: php-general@lists.php.net
> Subject: list files in a diretory
>
>
> How can I list the files in a diretory?
>
> Something like, get the files name in an array...
>
> thanks,
>
> Augusto Cesar Castoldi
>
>