title: PHP: readdir to scandir?
body: <p>i wonder how i can transform exactly the following piece of code to <code>scandir</code> instead of <code>readdir</code>?</p>
  
  <pre><code>$path = 'files';
  
  //shuffle files
  $count = 0;
  if ($handle = opendir($path)) {
      $retval = array();
      while (false !== ($file = readdir($handle))) {
          $ext = pathinfo($file, PATHINFO_EXTENSION);
          if ($file != '.' &amp;&amp; $file != '..' &amp;&amp; $file != '.DS_Store' &amp;&amp;
            $file != 'Thumbs.db') {
              $retval[$count] = $file;
              $count = $count + 1;
              } else {
              //no proper file
          }
      }
      closedir($handle);
  }
  shuffle($retval);
  </code></pre>