Home Tutorial Php List PHP list all files

 
 

Share on Google+Share on Google+
PHP list all files
Posted on: October 31, 2009 at 12:00 AM
Advertisement
In this part of the tutorial we will learn how to list all files of the given directory.We will use readdir() function to do it. And we will also see the example related to the readdir() function

  • All files, directories of the given directory can be listed.
  • function readdir() takes input as the directory handle.
  • Then readdir() returns the name of all the files and directories.


PHP List All Files Example

<?php
    $file
=opendir("c:/jboss-4.2.2.GA");
    while
($dir1=readdir($file))
      {
    echo $dir1."<br>";
       }
?>

Output:


..
bin
client
copyright.txt
docs
jar-versions.xml
JBossORG-EULA.txt
lgpl.html
lib
readme.html
server
Advertisement

Related Tags for PHP list all files:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 31, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com