Re: is_dir on WIndows
| From: | Mark | Date: | Mon, 27 Sep 2004 20:36:31 +0000 |
| Subject: | Re: is_dir on WIndows | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198008@lists.php.net to get a copy of this message | ||
--- Jason Wong <php-general@gremlins.biz> wrote:
> On Tuesday 28 September 2004 03:54, Mark wrote:
>
> > 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.
>
> Because is_dir() expects a path to the file as well, otherwise it
> would be
> trying to look at $file in it's current working directory (cwd)
> wherever that
> may be (most likely not $maildir).
>
> > It DOES recognize . and .. as directories, for some bizarre
> reason.
>
> Because all directories contain '.' and '..' and hence the cwd of
> is_dir()
> would have those. (BTW '.' and '..' ARE directories).
Perhaps I should have been more precise (I'm sure I should have...)
When I echo $file, it echos what I would expect (the names of the
files and directories. I guess I need to prefix $file in the is_dir
statement with the full path to the file?
So like this?
$maildir=MERCURY."/MAIL";
$handle=opendir($maildir);
while ($file = readdir($handle)) {
if (is_dir("$maildir/$file") && ($file!=".") &&
($file!="..")) {
$users[]=$file;
}
}
It seems contrary to what's in the help, but I'll try it out. Thanks!
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!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail