Re: Counting files in directory and subdirectory!
| From: | Nicholas Couloute | Date: | Wed, 25 Jan 2006 22:00:42 +0000 |
| Subject: | Re: Counting files in directory and subdirectory! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229273@lists.php.net to get a copy of this message | ||
I have used these functions but how would I count them! here is my attempt that doesn't work!:
$count = 0;
$dir = "/amrs";
$files1 = scandir($dir);
if ($files1 !== '.' && $files1 !== '..') {
foreach ($files1 as $files2){
$dir2 = "/amrs/$files2";
$files3 = scandir($dir2);
if ($files3 !== '.' && $files3 !== '..') {
foreach ($files3 as $files4){
$dir3 = "/amrs/$files2/$files4";
$files5 = scandir($dir3);
if ($files5 !== '.' && $files5 !== '..') {
foreach ($files5 as $files6){
$count++;
}
}
}
}
}
}
echo "$count";
~Nick Couloute
co-owner/Web Designer
Sidekick2Music.Com