$dir = '/'; $files = scandir($dir); $allfiles = count($files); echo $allfiles.""; for($i=0;$i<$allfiles;$i++) echo $files[$i].""; ?>