* Thus wrote Mark:
> 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!="..")) {

You need to provide the full path to is_dir():
  is_dir("$maildir/$file");

Otherwise it will simply look for $file relative to where the
script was called from.

A another way you could do this is:

  foreach(glob("$maildir/*", GLOB_ONLYDIR) as $dirname) {
    // only use the directory name not the full path.
    $users[] = substr($dirname, strrpos($dirname, '/')+1);
  }


Curt
-- 
The above comments may offend you. flame at will.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to