note 75815 deleted from function.is-dir by bjori
| From: | bjori@php.net | Date: | Sun, 17 Jun 2007 19:35:34 +0000 |
| Subject: | note 75815 deleted from function.is-dir by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127504@lists.php.net to get a copy of this message | ||
Note Submitter: info at mac-nukem dot de
Reason: 1
----
After a long search and many disfunctions I managed to write a simple routine which shows files in a
current folder AND subfolders!
My problem was, that the subfolders were shown as FILES!
So check this out:
$path= "./pix/";
if (is_dir($path))
{
if ($dh = opendir($path))
{
while (($file = readdir($dh)) !== false)
{
if(is_dir($path."/".$file))
{
echo"DIRECTORY: ";
}
else
{
echo"FILE: ";
}
echo"$file<br>";
}
}
}