Count Number of Files in Directory and Subdirectories
Count number of files in a directory and it’s subdirectories. Use the following code to count number of files. [php] <h1>Count Number of Files in Directory and Subdirectories</h1> <?php $dirnam=dirname(__FILE__); //No Trailing Slash// function count_files($dirpath, &$count) { $directorynames = glob($dirpath.’/*’); if(!empty($directorynames)) { foreach($directorynames as $directoryname) { if(is_dir($directoryname)) { $count[‘dirs’]++; count_files($directoryname, $count); } if(is_file($directoryname)) { $count[‘files’]++; … Read more