Dir file count

I am trying to get the number of files in a directory.

I have the following code

[php]
if ($handle = opendir(’…/uploads/0000004/’)) {
while (false !== ($file = readdir($handle))) {
if ($file != “.” && $file != “…”) {
$files = array($file);
echo “$file
n”;

    }
}
closedir($handle);

}
echo count($files);
[/php]

but its just returning 1

anyone have any suggestions

[php]$files[] = $file;[/php]

Thanks for that, works ok now

[php]

if ($handle = opendir(’…/uploads/0000004/’)) {
while (false !== ($file = readdir($handle))) {
if ($file != “.” && $file != “…”) {
$files[] = $file;

    }
}
closedir($handle);

}
if(count($files) < 6 ) { echo “More Files”; } else { echo “enough is enough”; }

[/php]

Just a quicky, I tried the scandir function and kept on getting the following error

[i][b]Call to a member function on a non-object [/b][/i]
Sponsor our Newsletter | Privacy Policy | Terms of Service