Here is my Code :::


        if ($handle = opendir('images/')) {
            echo "Directory handle: $handle\n";
            echo "Entries:\n";

            while (false !== ($entry = readdir($handle))) {
                echo "$entry\n";?><br/>
            <?php }

            /* This is the WRONG way to loop over the directory. */
            while ($entry = readdir($handle)) {
                echo "$entry\n";


Output : login.php

My Music
My Pictures

In this listing MY Music is folder but i did not open the folder.... Any solution for this particular problem.... 

Each new folder, you want to list the contents of, needs to opened with opendir as well. It's a recursive function.

function my_opendir($dir) {
  if ($handle = opendir($dir)) {
    echo "<ul>Directory handle: $dir<br />Entries:";

    while (false !== ($entry = readdir($handle))) {
      if($entry=="."||$entry=="..") { continue; }
      echo "<li>";
      if(is_dir($dir.$entry)) { my_opendir($dir.$entry); }
      else { echo $entry; }
      echo "</li>";
    echo "</ul>";


@AndrisP :: Thaxs... Bur when when i click on particular folder then and then only open this folder ...

How to click any file or folder in dirtectory listing ?
Any Solytion for this ?

in line 9 print entry as link, like: "<a href="".$entry."">".$entry."</a>"

Hello i want open only folder in directory listing not a file ?
There is any script avaiable in php ?