note 10942 modified in class.dir by aidan
| From: | aidan@php.net | Date: | Sat, 26 Jun 2004 10:45:37 +0000 |
| Subject: | note 10942 modified in class.dir by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71743@lists.php.net to get a copy of this message | ||
This lists all files from here (".") on down. [Linux;Apache/1.3.4;PHP 3.0.15]
<?php
function getDirList ($dirName) {
$d = dir($dirName);
while($entry = $d->read()) {
if ($entry != "." && $entry != "..") {
if (is_dir($dirName."/".$entry)) {
getDirList($dirName."/".$entry);
} else {
echo $dirName."/".$entry."<br>\n";
}
}
}
$d->close();
}
getDirList(".");
?>
--was--
This lists all files from here (".") on down. [Linux;Apache/1.3.4;PHP 3.0.15]
<?php
function getDirList ($dirName) {
$d = dir($dirName);
while($entry = $d->read()) {
if ($entry != "." && $entry != "..") {
if (is_dir($dirName."/".$entry)) {
getDirList($dirName."/".$entry);
} else {
echo $dirName."/".$entry."<br>\n";
}
}
}
$d->close();
}
getDirList(".");
?>
http://php.net/manual/en/class.dir.php