is_dir on WIndows
| From: | Mark | Date: | Mon, 27 Sep 2004 19:54:02 +0000 |
| Subject: | is_dir on WIndows | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-197999@lists.php.net to get a copy of this message | ||
I'm having a problem I haven't encountered before. I'm using PHP
4.3.4 (upgrading the 4.3.9, but humor me) on Windows.
I'm using the following code snippet to try to get all the
subdirectories of a directory into an array.
$maildir=MERCURY."/MAIL";
$handle=opendir($maildir);
// echo $handle;
while ($file = readdir($handle)) {
// echo $file;
// echo is_dir($file)."<BR/>";
if (is_dir($file) && ($file!=".") && ($file!="..")) {
$users[]=$file;
}
}
What this should do (if I'm not a complete idiot), is put all the
true subdirectories (excluding . and ..) into the array $users. There
are two additional subdirectories under the $maildir directory.
However the array is empty. As you can see, I tried echoing out $file
and whether it is a directory, but it came up as not recognizing the
directories as such.
With the echos above in place, I get the resource handle, and it
echos everything you would expect except that is_dir() fails to
recognize the directories.
It DOES recognize . and .. as directories, for some bizarre reason.
And no, I can't switch to linux.
Any ideas?
Mark
=====
Mark Weinstock
mark_weinstock@yahoo.com
***************************************
You can't demand something as a "right" unless you are willing to fight to death to
defend everyone else's right to the same thing.
***************************************
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail