File Directory Php



Listing the Contents of a Directory with readdir()



$dirname = ".";
$dh = opendir( $dirname );
while ( ! is_bool( $file = readdir( $dh )) ) {
  if ( is_dir( "$dirname/$file" ) ) {
    print "(D) ";
  }
  print "$file
";
}
closedir( $dh );
?>