Loop through directories and look for directory name in PHP
<p>I'm trying to make a truncate system.</p>

<p>I want to permanently delete whole directories that are older than 14 days. The directories are named with dates in this format: dd-mm-yyyy</p>

<pre><code>$path = "sites/sitename/.trash/";
$lastDate = date('Y-m-d', strtotime("+14 days"));
</code></pre>

<p>Is what I currently have. Which get the date in 14 days. I would like now to loop through the directories and check their names if they match $lastDate or are over that date.</p>

<p>So it would be something like:</p>

<pre><code>if($pathName &gt;= $lastDate) { $this-&gt;deleteDir($pathName); } 
</code></pre>

<p>How can I do this? Looping through and check for their directories names, inside my $path (.trash/ directory where all the other date-named directories exists)</p>
