On 14 Aug 2004 14:42:19 -0000, PHPDiscuss - PHP Newsgroups and mailing
lists <[EMAIL PROTECTED]> wrote:
> Codes attached.
> In this page i used filetype instead of is_dir.
> 
> <?php
> $dir = "jdkcoders/";
> function getfiles($dir)
>  {
>  if (is_dir($dir)) {
>     if ($dh = opendir($dir)) {
>         while (($file = readdir($dh)) !== false)
>                  {  if($file!='.' && $file!='..')
>                                 {
>                                         if(filetype($dir . $file)=='dir')
>                                                 {
>                                                 getfiles($dir."/".$file);

Look at the two above lines. One adds a '/' and the other diesn't. Try
adding it to the first one.

>                                                 }
>                                         else
>                                                 {
> 
>                                                 echo "<br>$file";
> 
>                                                 }
>                                 }
>                  }
>     closedir($dh);
>                  }
>         }
>   }
> getfiles($dir);
> ?>
> 
> Hope you can help me.
> Thanks.
> 
> John Holmes wrote:
> 
> > PHPDiscuss - PHP Newsgroups and mailing lists wrote:
> > > Hello Professionals,
> > > Can anybody help me to open all subdirectories in a directory,
> > > I used is_dir() to check whether it is a dir, and if yes,
> > > I recursively called it with the new dir name.
> > > But  all subdirectories are not open the recursion is not working for more
> > > than 1 level.
> > > I tested it in windows server.
> > > Expecting your help,
> 
> > Expecting your code...
> 
> > Have you looked at the opendir manual page to see if there are any
> > examples, there?
> 

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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

Reply via email to