Re: directory structure list
| From: | Mike Frazer | Date: | Fri, 25 Jan 2002 00:01:36 +0000 |
| Subject: | Re: directory structure list | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-81958@lists.php.net to get a copy of this message | ||
Write the whole thing as a function, and then do a check like
if (is_dir("/path/to/directory")) {
listDirs("/path/to/directory");
}
PHP will allow you to recursively call a function from with that same
function.
Mike Frazer
<sean@interconnect.is.it> wrote in message
news:200201242045.OAA31498@lsh100.siteprotect.com...
> Hello,
>
> I need to print out a list of directories, which is a piece of cake, just
do something out of the manual:
> <?php
> $handle = opendir('.');
> while (false != ($file = readdir($handle))) {
> if ( ($file != ".") && ($file != "..") && (is_dir
> ($file)) )
> echo "<li>$file</li>\n";
> }
> closedir($handle);
> ?>
>
> The thing is, I need the sub-directories, and the sub-directories under
them... ad infinitum in a list format.
> i.e.
> *Dir1
> *SubDir1of1
> *SubDir2of1
> *Dir2
> *SubDir1of2
> *SubSubDir1of2
> ... etc.
>
> There are some truly great php applications for this, such as:
> http://freshmeat.net/projects/phpmyexplorer/
> But it's way ahead of what I need.
>
> Any crafty suggestions?
>
> Thanks for any input,
>
> Sean
>
>
>