Hey,
I am writing a PHP backup script that should be recursive in order to search through sub directories. But, before I make it recursive, I need to figure out why it is not recognizing subdirectories as directories? I used the PHP code provided on the PHP manual web site, but added in a line just to test out printing subdirectory names:
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "<br />$file
";
} elseif (is_dir($file)){ echo "<br />Directory: $file"; }
}
closedir($handle);
}
I was thinking… do permissions on folders have anything to do with this? Why won’t it recognize subdirectories as a TRUE in is_dir($file)? Right now it only prints out “.” and “…” as directories but the subdirectories print as if they are files.
Anyone have any ideas?