Posted By

martinbrait on 07/29/19


Tagged

list dir array files


Versions (?)

Lister tous fichiers contenus dans un dossier


 / Published in: PHP
 

php list all files of a given directory

  1. <?php
  2. //The second example shows how to retrieve only the files
  3. //contained in a given path.
  4.  
  5. $filelist = array();
  6. if ($handle = opendir(".")) {
  7. while ($entry = readdir($handle)) {
  8. if (is_file($entry)) {
  9. $filelist[] = $entry;
  10. }
  11. }
  12. closedir($handle);
  13.  
  14. }
  15. print_r ($filelist);
  16. ?>

Report this snippet  

You need to login to post a comment.