is_dir() function on Win32 platform
| From: | Michael Hall | Date: | Thu, 01 Feb 2001 20:27:59 +0000 |
| Subject: | is_dir() function on Win32 platform | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-37715@lists.php.net to get a copy of this message | ||
I'm developing on Windows, and I have a bit of code that is designed to do a
quick recursive read on a folder. An integral part of this is the use of
the is_dir() function to decide if it should recurse or not.
DoIt('G:\\');
function DoIt($path){
$handle=opendir("$path");
echo "Directory handle: $handle\n<br>";
echo "Files:\n";
while (($file = readdir($handle))) {
if (is_dir($file) and $file != '.'){ #otherwise the '.' will send it into
a loop
print "<dir>";
DoIt($file);
print "</dir>";
} else {
print "<li>".$file;
}
}
closedir($handle);
}
The problem I have is rather odd. It seems to work on one machine (a
Windows NT 4 box) but on two others (one windows 98 and one NT4) the
if_dir() function returns false for everything except the . directory.
Does anyone know why this would be?
thanks.
Michael Hall
Database Engineer
Prairie Fire Web Design
mike@pfbiz.com