Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Print all files in a directory

Sun Oct 26, 2008 8:47 pm

Code:

<?php
$dirname 
".";
$dh opendir($dirname) or die("couldn't open directory");

while (!((
$file readdir($dh)) === false ) ) {
  if (
is_dir("$dirname/$file")) {
    echo 
"(D) ";
  }
  echo 
$file."<br/>";
}
closedir($dh);
?>




Post a reply
  Related Posts  to : Print all files in a directory
 print all files names in folder     -  
 show all files in a directory with detail     -  
 compute number of files in directory     -  
 count the number of files in directory & its sub directories     -  
 Help for Print using php     -  
 Print the ASCII Set     -  
 print element in 2d matrix     -  
 Get union of two arrays set and print it     -  
 How to print a webcam picture in Jsp     -  
 Difference between PHP echo() and PHP print()?     -  

Topic Tags

PHP Files and I/O