Home Tutorial Php List PHP listing files in folder

 
 

Share on Google+Share on Google+
PHP listing files in folder
Posted on: November 2, 2009 at 12:00 AM
Advertisement
In this tutorial we will learn how to list all files present in the folder. In the example we will show it with the use of readdir() function

  • All files, folder   of the given folder can be listed.
  • Function readdir() takes input as the folder handle.
  • Then readdir() returns the name of all the files and folders.


Example of PHP Listing Files in Folder
<?php
     $file
=opendir("c:\apache-maven-2.1.0-bin");
     do
    
{
     echo
$a."<br>";
      }
     while
($a=readdir($file));
?>


Output
.
..
bin
boot
conf
lib
LICENSE.txt
NOTICE.txt
README.txt
Advertisement

Related Tags for PHP listing files in folder:


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: November 2, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com