Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i count the number of files in a directory?

Status
Not open for further replies.

farley99

MIS
Joined
Feb 12, 2003
Messages
413
Location
US
$dirHandle = opendir("./images");
$i = readdir($dirHandle)):
echo number of files in $i; <---- what is the correct syntax for this?
closedir($dirHandle);
 
...
for ($fcnt = 0; false !== ($filename = readdir($dh)); ++$fcnt)
;
$fcnt -= 2; // minus . and .. entries.
...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top