title: PHP Count through different directories and see which ones have 0 files in them
body: <p>I have the following folder structure:</p>
  
  <pre><code>images/photo-gallery/2e/
                       72/
                       rk/
                       u3/
                       va/
                       yk/
  </code></pre>
  
  <p>... and so on.  Basically, each time an image is uploaded it hashes the name and then creates a folder with the first two letters. So inside of 2e is <strong>2e0gpw1p.jpg</strong></p>
  
  <p>Here's the thing... if I delete an image, it will delete the file but it will keep the folder that it's in.  Now when I have a TON of images uploaded, that will be fine since a lot of images will share the same folder.. but until then, I  will end up having a bunch of empty directories.</p>
  
  <p>What I want to do is search through the photo-gallery folder and go through each directory and see which folders are empty.. if there are any empty folders then it will remove it.</p>
  
  <p>I know how to do that for a single directory, like the 2e folder.  But how would I do it for all the folders inside the photo-gallery folder?</p>