I use this:
$path = '/path/to/dir'
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$fName = $file;
$file = $path.'/'.$file;
if(is_file($file)) $numfile++;
if(is_dir($file)) $numdir++;
};
};
closedir($handle);
};
echo $numfiles.' files in: '.$path;
echo $numdir.' subdirectories in: '.$path;
Fairly easy to understand..
Greets,
Gh0sT