List of all files under directory and also its subdirectories recursively.function listFolderFiles($dir){ $ffs = scandir($dir); echo '<ol>'; foreach($ffs as $ff){ if($ff != '.' && $ff != '..'){ echo '<li>'.$ff; if(is_dir($dir.'/'.$ff)) listFolderFiles($dir.'/'.$ff); echo '</li>'; } } echo '</ol>'; }
listFolderFiles(dirname(__FILE__)'/Main Dir');
dirname(__FILE__) gives you the file name where you are.
No comments:
Post a Comment