scandir not working properly php
<p>Does any one know how to scan directory recursively in php ?</p>

<pre><code>$fileslist = array();

function readRecursive($dirname) {
   global $fileslist;
   $dir = scandir($dirname);

    foreach ($dir as $f) {
      if($f != "." &amp;&amp; $f != ".." &amp;&amp; $f != ".DS_Store") {
         if(is_dir($dirname.DIRECTORY_SEPARATOR.$f)) {
            $dname = $dirname.DIRECTORY_SEPARATOR.$f;
            readRecursive($dname);
         } else {
            $fileslist[] = $dirname.DIRECTORY_SEPARATOR.$f;
         }
      }
   }
}
</code></pre>

<p>following code doesn't work any idea 
Thanks in advance</p>
