http://www.php.net/manual/en/ref.dir.php
These php functions should be able to help.
Some more specifics here--
From the opendir page -- http://www.php.net/manual/en/function.opendir.php
PHP Code:
<?php
$dir = "/etc/php5/";
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
echo "filename: $file : filetype: " . filetype($dir . $file) . "\n";
}
closedir($dh);
}
}
?>
From the readdir page -- http://www.php.net/manual/en/function.readdir.php
PHP Code:
<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file\n";
}
}
closedir($handle);
}
?>
This should point you toward what you're looking for. Using a mix of those functions should allow you to create a nice directory listing script.
You can even make it layered, so you have the contents of inner folders listed too.
Decide what you want exactly and then look at those pages to see which functions you should use.
Note that all of this requires PHP, so you need it installed on your server and enabled (in many/most cases, it is), and your page must be processed by the PHP parser, so it needs to end with .php, not .htm, etc. All of your html will function the exact same way, but this allows for php as well.
Bookmarks