note 37112 added to class.dir
| From: | daemon at freemail dot lt | Date: | Mon, 03 Nov 2003 19:15:01 +0000 |
| Subject: | note 37112 added to class.dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59729@lists.php.net to get a copy of this message | ||
I used this simple alg to list * files. Works fine on XP ;)
<?
function listdir($dir)
{
function ls_recursive($dir)
{
if (is_dir($dir))
{
$dirhandle=opendir($dir);
while(($file = readdir($dirhandle)) !== false)
{
if (($file!=".")&&($file!=".."))
{
$currentfile=$dir."/".$file;
echo $currentfile."<br>";
if(is_dir($currentfile))
{
ls_recursive($currentfile);
}
}
}
}
}
echo $dir."<br>";
ls_recursive($dir);
}
//main
{
$dir="c:/";
listdir($dir);
echo "All done.";
}
?>
----
Manual Page -- http://www.php.net/manual/en/class.dir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37112
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37112&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37112&report=yes
Search -- http://master.php.net/manage/user-notes.php