AndrewFerrara Posted January 28, 2011 Share Posted January 28, 2011 Displaying the number of files in a directory and its subdirectorys <?php $path = './images_cache'; if ($handle = opendir($path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $fName = $file; $file = $path.'/'.$file; if(is_file($file)) $numfile++; if(is_dir($file)) $numdir++; }; }; closedir($handle); }; echo $numfiles.' files in a directory'; echo $numdir.' subdirectory in directory'; ?> Link to comment https://forums.phpfreaks.com/topic/225915-number-of-files-in-directory-and-subdir/ Share on other sites More sharing options...
Pikachu2000 Posted January 28, 2011 Share Posted January 28, 2011 So, what's your question? Link to comment https://forums.phpfreaks.com/topic/225915-number-of-files-in-directory-and-subdir/#findComment-1166366 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.