Get image out, one by one, from a "images" directoy, using - PHP
<p>OK I have a folder with ALL website images (news category ones, only, of course) at only one location called "images/pictures". That folder is PHP controlled. After submitting news to my website, GD (after resizing and stuff) stores images to that location. That works perfect. Even thus, after PHP controlled removal of news from CP, PHP automatically deletes those unnecessary files, images, given from MySql entries. That works perfect.</p>

<p>But, as time goes on.. lots of images left in folder due to sloppy DB/foder backups, changes or some experiments. Even more, recently I had a mess with that folder, so now I have lots of (unnecessary) images in that folder ready to be deleted.</p>

<p>Anyway, I have an idea how to do that.</p>

<ol>
<li><p>PHP to read all images from that directory at first,</p></li>
<li><p>And get every file out, one by one, as a string for while loop (ready to be controlled by MySql for deleting or not).</p></li>
</ol>

<p>Any advice how to achieve that by using PHP? </p>
