Files
Posted: Thu Jan 23, 2003 6:01 pm
Does anybody know of a function that would get the number of files in a given directory? I've been unable to find such a function.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
function fileCount($dir) {
$dirHandle = opendir($dir);
$fileCount = 0;
while (($file = readdir($dirHandle)) !== FALSE) {
$fileCount++;
}
return $fileCount;
}