Re: listing directories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I replaced is_dir() with filetype() and code works just fine.
But the question is still there!
:)

-afan

afan@xxxxxxxx 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@xxxxxxxx <afan@xxxxxxxx> 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









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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux