Re: dir()
| From: | Comron E Sattari | Date: | Thu, 06 Jul 2000 07:45:44 +0000 |
| Subject: | Re: dir() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-5182@lists.php.net to get a copy of this message | ||
thats not the problem (yet) but ill take it into account... the eco statment
right before that is only printing files - not directories. Which makes me
thing there is somthing wrong with the way im using dir() or ->read()...
----- Original Message -----
From: "David Robley" <huntsman@www.nisu.flinders.edu.au>
To: <csattari@jps.net>
Cc: <php-general@lists.php.net>
Sent: Thursday, July 06, 2000 12:37 AM
Subject: Re: [PHP] dir()
> On 6 Jul, Comron E Sattari wrote:
> > hey,
> >
> > I'm trying to use dir() to get a listing of subdirectories... but i am
> > failing.
> >
> > here is the code, but it is only echo'ing files, no directories...
> >
> >
> > $i = 0;
> > $d = dir("./image.db");
> > while($entry=$d->read())
> > {
> > echo $entry . "<BR>";
> > if ( is_dir($entry) )
> >
> > $array[$i++] = $entry; }
> > }
> > $d->close();
> > /*echo count($array); debug*/
> >
> > for($i = 0; $i < count($array); $i++)
> > {
> > echo $array[$i];
> > }
> >
> >
> > thanks,
> > comron
>
> You may need to prepend the directory name to $entry before you test if
> it is a directory, otherwise the test will be made in the current
> working directory, which may not be what you want.
>
> Cheers
> --
> David Robley | WEBMASTER & Mail List Admin
> RESEARCH CENTRE FOR INJURY STUDIES |
> http://www.nisu.flinders.edu.au/
> AusEinet |
> http://auseinet.flinders.edu.au/
> Flinders University, ADELAIDE, SOUTH AUSTRALIA
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>