File count
Posted: Thu Aug 23, 2007 4:17 pm
How can I count how many files are in a directory excluding "." and ".."?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
$dir = opendir("/home/wiles63/public_html/jobstatus/files/17/");
$file_count = count(readdir($dir));
echo $file_count;
if($file_count == "0") {
echo "<big><font color=\"#FF0000\"><b>No files have been attached!</b></font></big>";
}Code: Select all
<?php
echo count( glob( '/home/wiles63/public_html/jobstatus/files/17/*' ) );
?>icesolid used readdir().hawleyjr wrote:Just tested it and it works fine for me....?