Sunday, March 28, 2010

count files in a folder/directory

Hi all,

We can count files in a folder using the following function.
It return the no of files in the directory provided as input argument

function count_files ($dir) {
$count = count(glob($_SERVER['DOCUMENT_ROOT'].$dir . "*")) ;
return $count;
}

thanks
Jawed