tags:

views:

30

answers:

1

hi everyone

I want to access all files and folders in a specific directory on server (for eg. "home"). Is there a way to do it? or i just need to say everything in database?

Also i want to create a kind of File Manager that manages all the files and folders in a specific directory on server (for eg. "home") like on windows we have file explorer.

Please help me...

Thank you for any help Regards

A: 

try this simple php snippet and customize it your own way:

<?php
 $directory = "./";
 //Directory is set;

 $dir = opendir($directory);
 //Opened the directory;

 while($file = readdir($dir)){
  //Loops through all the files/directories in our directory;   
    if($file!="." && $file != ".."){
        if(is_dir($file)) echo '<strong>'.$file.'</strong><br>';
        else echo $file."<br/>\n";
    }   
  }
?>

it'll output all the files & folders(not the subfolder files) in the current/provided dir.

Vaibhav Gupta
Thanks alot...got it where to start from....really thanks alotRegards