Use PHP to count images in specific subdirectories
<p>I've got images stored in a directory structure a bit like this:</p>

<ul>
<li>images
<ul>
<li>foo
<ul>
<li>thumb
<ul>
<li>awefawef.jpg</li>
<li>dtyhtyh.jpg</li>
</ul></li>
<li>full
<ul>
<li>awefawef.jpg</li>
<li>dtyhtyh.jpg</li>
<li>eriguherg.jpg</li>
</ul></li>
</ul></li>
<li>bar
<ul>
<li>thumb
<ul>
<li>erg.jpg</li>
</ul></li>
<li>full
<ul>
<li>erg.jpg</li>
<li>tyjhr5g.jpg</li>
</ul></li>
</ul></li>
<li>some_other_dir</li>
<li>etc ...</li>
</ul></li>
</ul>

<p>(Note: There won't always be the same number of images in a "thumb" directory as in it's neighbouring "full" one.)</p>

<p>So: <strong>I need to use PHP to count the total number of images in all of the "full" directories.</strong></p>

<p>I'm sure I could find a way to do this by getting a list of all subdirectories of "images", then cycling through them and counting the images in each one's "full" folder. But as there are going to be thousands of directories with hundreds of images in each folder, I'm looking for the most efficient solution possible - this is going to need to be done pretty often by the site.</p>

<p>What's the most efficient approach here?</p>
