Codice PHP:
$c 0;
$dir opendir("./");
while(
$file readdir($dir))
{
    if(!
is_dir($file)) $c++;
}
echo 
$c