Forum Moderators: coopster
this is my folder structure
-top folder 1
--sub folder a
--sub folder b
-top folder 1
--sub folder a
--sub folder b
-top folder 3
--sub folder 1
---sub folder a
---sub folder b
--sub folder a
--sub folder b
-top folder 4
--sub folder a
--sub folder b
ect...
all folder a's have the same name, and all folder b's have the same name. I want to be able to return a caluclated value divided by 2 of any and all folders named sub folder a. With the folders being located on different directory levels, i havent been able to get the desired results.
I found this little script:
<?php
function num_files($directory='.')
{
return count(glob($directory."/top folder 1/*/sub folder a/*"));
}
echo num_files();
?>
but it doesnt look to be counting the second level sub folder a. I should get a total count of 1232... well, 1233 if it counts the thumbs.db file, but if possible i would like that divided by 2 for the real count of 616. the script above returns a count of 917 (non divided)
thanks for any help :)