Print all files under a directory : Directory : File Directory PHP Source Code


PHP Source Code » File Directory » Directory »

 

Print all files under a directory




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

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

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo File Directory
» Directory