note 42162 deleted from function.readdir by tularis
| From: | tularis@php.net | Date: | Sun, 13 May 2007 19:05:27 +0000 |
| Subject: | note 42162 deleted from function.readdir by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126541@lists.php.net to get a copy of this message | ||
Note Submitter: phpnet at public dot buyagun dot org
----
Another simple recusive directory listing function.
<?php
$BASEDIR="/tmp";
function recursedir($BASEDIR) {
$hndl=opendir($BASEDIR);
while($file=readdir($hndl)) {
if ($file=='.' || $file=='..') continue;
$completepath="$BASEDIR/$file";
if (is_dir($completepath)) {
# its a dir, recurse.
recursedir($BASEDIR.'/'.$file);
print "DIR: $BASEDIR/$file<br>\n";
} else {
# its a file.
print "FILE: $BASEDIR/$file<br>\n";
}
}
}
recursedir($BASEDIR);
?>