PDA

View Full Version : display directory tree


Lucia
09-17-2002, 03:32 AM
how can i display a server directory tree (with subfolders) in a webpage?(unless FTP view...)

Thanks !

Dynasty
09-17-2002, 04:27 AM
Well you'd have to use a scripting language like php or asp.


Something like this in php

<?php
$dir = "/";
$dh = opendir( $dir );
while ( gettype( $file = readdir( $dh )) != boolean )
{
if ( is_dir( "$dir/$file" ) )
{
echo "$file <br>";
}
}
closedir( $dh );
?>


Well not exactly. That displays folders in the root.

BoR|S
09-17-2002, 10:39 AM
Or an easier way (depends on the server preferences) suggested here (http://developers.evrsoft.com/forum/showthread.php?s=&threadid=177) .

-TheDarkEye-
09-17-2002, 12:34 PM
easier but less functional.

Dynasty
09-17-2002, 01:33 PM
Plus not very secure really, letting people browse a directory :P

BoR|S
09-18-2002, 09:52 AM
Well, wasn't that what he wanted?

Dynasty
09-19-2002, 03:11 AM
I think all he wanted was a list of all the directories and sub directories, not the files within.

BoR|S
09-19-2002, 10:08 AM
Oh, whatever, let it be, my suggestion also allows him to navigate :cool: