note 10094 added to Directory functions
| From: | fancao0515 at 0451 dot com | Date: | Wed, 13 Dec 2000 06:06:26 +0000 |
| Subject: | note 10094 added to Directory functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8672@lists.php.net to get a copy of this message | ||
List all files in a directory tree under Win32:
function list_dir($dirname)
{
if($dirname[strlen($dirname)-1]!='\\')
$dirname.='\\';
static $result_array=array();
$handle=opendir($dirname);
while ($file = readdir($handle))
{
if($file=='.'||$file=='..')
continue;
if(is_dir($dirname.$file))
list_dir($dirname.$file.'\\');
else
$result_array[]=$dirname.$file;
}
closedir($handle);
return $result_array;
}
http://www.php.net/manual/ref.dir.php