I want to get list of all directory and sub-directory if parent directory is provided. i am using Apache web server and php as scripting language.
Asked
Active
Viewed 97 times
-2
-
as @Andrew mentions, we need to see what you've tried. – alexwc_ Dec 12 '15 at 17:29
-
1Welcome to StackOverflow. I can recommend to read [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask). – StephenKing Dec 12 '15 at 17:58
1 Answers
0
This is an example of the documentation from php.net you should try ;)
<?php
$dir = "/home/user1/";
$files1 = scandir($dir);
print_r($files1);
?>
Give me news. Whereas, after, try to said us what you tried ;)
To test if the file is a dir for example: cf: is_dir documentation
<?php
var_dump(is_dir('a_file.txt')); // false
var_dump(is_dir('bogus_dir/abc')); //false
var_dump(is_dir('..')); //true
?>

Henri Devigne
- 44
- 1
- 6
-
-
Hi, You have to use is_dir, i think the autor may have found that ^^ i just update the answer – Henri Devigne Dec 12 '15 at 19:54