is_dir() problem

Posted on 16th Feb 2014 by admin

Hello,

I'm buidling a php scripts that dynamically get's subfolders from a specific folder.
my code:

Code: <?php

if(isset($button)){

$opendirdepot = opendir("C:/xampp/htdocs/arl/$depot/");


while($dirdepot = readdir($opendirdepot)){

if(is_dir($dirdepot)){

echo "Is a folder: ".$dirdepot."<br />";

}else{

echo "Is not a folder: ".$dirdepot."<br />";

}

}

closedir($opendirdepot);

}

?>
Output:

QuoteIs a folder: .
Is a folder: ..
Is not a folder: 20091012
Is not a folder: 20091013
Is not a folder: Error_.log
Is not a folder: Error_20091013.log
The problem is that 20091012 and 20091013 are in fact folders.

Anyone an idea?

Thanks

Other forums