//how to count directory file and echo $directory = "/path/to/dir/"; $filecount = count(glob($directory . "*")); echo "There were $filecount files";