Re: read all files in directory
| From: | Lars Torben Wilson | Date: | Sat, 11 May 2002 22:59:41 +0000 |
| Subject: | Re: read all files in directory | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97183@lists.php.net to get a copy of this message | ||
On Sat, 2002-05-11 at 15:52, olinux wrote:
> $dirPath = "C:\somepath";
> $dhandle = opendir($dirPath);
>
> while ($filename = readdir($dhandle)) {
This will bail on the first directory entry which has a name which
evaluates to false. Try it after 'touch 0' in the directory you're
scanning....the examples in the manual show how to do it safely.
> echo $filename . "<br>";
>
> }// end read filenames
--
Torben Wilson <torben@php.net>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506