On Friday, February 16, 2001, at 10:31 AM, Hoover, Josh wrote:

> Try this bit of code and see if it works.  (I don't know if there's a less 
> taxing (on the server) way to get a count of files in a directory or not.) 

this code snippet won't work as a standalone. you are referencing an object that does 
not exist.

> $myDirectory = dir("yourdirectory"); 
> while($entry=$myDirectory->read())  
> { 
>     $filecount++; 
> } 
> $myDirectory->close(); 
>  

you are on the right track though. if you are sure that everything in the directory 

$d=opendir("path/to/my/directory");

$i=0;

while($found=readdir($d)) {

        if($found != "." && $found != "..") {

                $i++;

        }

}

print("there were $i files found.");


:: Andrew Rush :: Lead Systems Developer :: MaineToday.com :: 
:************************************************************************** 
"Crippled 
:but free, blind all the time, i was learning to see" 
 
- J. Garcia / R. Hunter 
:************************************************************************** 
 
The  
:views expressed herein are not necessarily those of my employer, but  
they let me 
:have them anyway.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to