I'm attempting to build an array of filenames in a sub-directory with
sub-directories. I'm using a modified version of code found on php.net -
the function I wrote is here:
function getDirList ($dirName) {
$dirList=array();
$d = dir($dirName);
while ($entry = $d->read()) {
if ($entry != "." && $entry != "..") {
if (is_dir($dirName."/".$entry)) {
echo "<b>Directory found: $entry</b><br>\n";
$dirList = $dirList + getDirList($dirName."/".$entry);
} else {
$temp = $dirName."/".$entry;
$temp = str_replace("/var/www/html/boarddocs/", "", $temp);
echo $temp."<br>\n";
$dirList[] = $temp;
}
}
}
return $dirList;
}
It's called with: $bplist = getDirList($bppath);
$bppath is correct.
The problem is that although my testing of the function shows all of the
entries correctly (note the 'echo $temp' line), not all of these entries
are ending up in the array - in fact, large chunks of some directories,
and all of other directories, are missing.
Sample output is here: http://www.silvervalley.k12.ca.us/boarddocs/bpar.php
Complete code is here: http://www.silvervalley.k12.ca.us/boarddocs/bpar.phps
I'm gonna be real annoyed if I missed something stupid. I built as much
debugging output into this as I thought I should, but your help will be
appreciated.
--
_______ ___ _ ____ _____
Chris Hobbs / ____\ \ / / | | |/ ___\| __ \
Head Geek | (___ \ \ / /| | | | (___ | | | |
WebMaster \___ \ \ \/ / | | | |\___ \| | | |
PostMaster ____) | \ / | |__| |____) | |__| |
\____/ \/ \____/ \____/|_____/
http://www.silvervalley.k12.ca.us
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]