Re: directory list function?
| From: | Maciek Ruckgaber Bielecki | Date: | Fri, 27 Dec 2002 21:11:24 +0000 |
| Subject: | Re: directory list function? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129473@lists.php.net to get a copy of this message | ||
ohhhh of course !!
mine won't work in !UNIX ;-)
On Fri, 27 Dec 2002, Johannes Schlueter wrote:
> On Friday 27 December 2002 21:46, Maciek Ruckgaber Bielecki wrote:
> > depending on what you need, sometimes this does the trick for me :-)
> >
> > exec("ls path/",$files);
> >
> > foreach($files as $value)
> > {
> > $elem .= $value."\n";
> > }
> >
> > echo $elem;
>
> This should
>
> <?php
> $i=0;
> if ($dir = opendir('/insert/directory/name/here')) {
> while (($file = readdir($dir)) !== false) {
> $i++;
> }
> closedir($dir);
> }
> ?>
> (ok, this one counts even . and ..)
> johannes
>
>