php count number of files in directory
$fi = new FilesystemIterator(__DIR__, FilesystemIterator::SKIP_DOTS);
printf("There were %d Files", iterator_count($fi));
php count number of files in directory
$fi = new FilesystemIterator(__DIR__, FilesystemIterator::SKIP_DOTS);
printf("There were %d Files", iterator_count($fi));
count files in folder php
// You can get the filecount like so:
$directory = "/path/to/dir/";
$filecount = 0;
$files = glob($directory . "*");
if ($files){
$filecount = count($files);
}
echo "There were $filecount files";
// where the "*" is you can change that to a specific filetype if you want like "*.jpg" or you could do multiple filetypes like this:
// the GLOB_BRACE flag expands {a,b,c} to match 'a', 'b', or 'c'
// glob($directory . "*.{jpg,png,gif}",GLOB_BRACE);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us