Dr-Wordpress : how to count the number of files in any directory using php.
<?php
//Counts starts at 0
$i = 0;
$dir = 'images/Trip_images/';
if ($handle = opendir($dir)) {
while (($file = readdir($handle)) !== false){
if (!in_array($file, array('.', '..')) && !is_dir($dir.$file))
$i++;
}
}
// print count files in directory
echo "There were $i files";
?>