Re: listing directories

From: Date: Tue, 15 Mar 2005 16:58:14 +0000
Subject: Re: listing directories
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-210834@lists.php.net to get a copy of this message
I replaced is_dir() with filetype() and code works just fine. But the question is still there! :) -afan afan@afan.net wrote:
Ok, I wasn't able to find anything in archive to fit my needs... This is a problem: To display content of directory I have this code: if ($dir = opendir($path)) { while($file = readdir($dir)) {
       if ($file != "." && $file != "..")
       {
       echo "$file";
           if (is_dir($file))
           {
               echo ' <- folder<br>';
           }
           elseif (is_file($file))
           {
               echo ' <- file<br>';
           }
           else
           {
               echo ' <- ????????<br>';
           }
       }
   }    closedir($dir);
} But is_dir($file) doen't recognize the directory EVERY TIME. E.g. log <- folder CSVs <- folder php_images <- ???????? admin <- ???????? images <- folder includes <- folder and "php_images" and "admin" are direktories too. In directory with folders (named after product number) didn't recognize ANY. 22 <- ???????? 54 <- ???????? 86 <- ???????? 91 <- ???????? 94 <- ???????? 97 <- ???????? CD <- ???????? F4 <- ???????? W1 <- ???????? 690000-05 <- ???????? 107 <- ???????? 113 <- ???????? 150 <- ???????? 220 <- ???????? 221 <- ???????? What am I doing wrong? Thanks. -afan Fernando Gutierrez wrote:
http://es.php.net/manual/en/function.opendir.php On Tue, 15 Mar 2005 10:00:19 -0600, afan@afan.net <afan@afan.net> wrote:
Hi guys, Few days ago somebody asked something about listing content of directories and subdirectories. How I can get answers on this queastion? I have a same problem and don't want to bother you again with same thing :) Thanks -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#210834) next »