Posted By

pruntrut on 05/21/12


Tagged

php files


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tux-world


List all files in a diretory with glob (2)


 / Published in: PHP
 

URL: http://www.brightcherry.co.uk/scribbles/php-list-all-files-in-a-directory/

List all files in a diretory with glob

  1. //path to directory to scan
  2. $directory = "../images/team/harry/";
  3.  
  4. //get all image files with a .jpg extension.
  5. $images = glob($directory . "*.jpg");
  6.  
  7. //print each file name
  8. foreach($images as $image)
  9. {
  10. echo $image;
  11. }

Report this snippet  

You need to login to post a comment.