ID:               19658
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Bogus
 Bug Type:         Directory function related
 Operating System: Windows 2000
 PHP Version:      4.2.0
 New Comment:

Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.

teh filename returned by readdir() is 
always relative to the opened directory
you have to concatenate dir- and filename
to get the complete path

like 
 
  $dir = 'C:\Webpages\';
  if ($handle = @opendir($dir)) {
   while (false !== ($file = readdir($handle))) {  
           if (is_dir($dir.$file)) { 



Previous Comments:
------------------------------------------------------------------------

[2002-09-29 14:36:43] [EMAIL PROTECTED]

Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

------------------------------------------------------------------------

[2002-09-29 08:22:20] [EMAIL PROTECTED]

This script works OK:
if ($handle = @opendir('.')) {
   while (false !== ($file = readdir($handle))) {  
           if (is_dir($file)) { 
                   echo "Is directory $file <BR>"; 
                   }
                   else Print "Is file $file <BR>";
   }
   closedir($handle); 
}
When I replace "." with i.e. "C:\webpages\test" (this is the directory
where I run the script from) it also works fine.
But when I try the read a directory which is not in the same directory
as the script i.e. "C:\webpages" than it displays that there are only
files. So reading a directory lower or higher that the direcory where
you are running a script from gives a wrong output.

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=19658&edit=1

Reply via email to