PHP will be simplest, methinks...
Code:
<?php
function recurseDir($c) {
echo("<ul>");
$d = opendir($c);
while($f = readdir($d)) {
if(strpos($f, ".") === 0) continue;
$ff = $c . "/" . $f;
echo("<li><a href=\"$ff\">$ff</a>\n");
if(is_dir($ff)) recurseDir($ff);
echo("</li>");
}
echo("</ul>");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>
The Head Doom Fish Recursor, by Twey
</title>
</head>
<body>
<p>
<?php
recurseDir(".");
?>
</p>
</body>
</html>
It's in HTML format because it's easier to read. If you require it to be in text form, that's not too difficult; try this:
Code:
<?php
header("Content-Type: text/plain");
function recurseDir($c, $l = -1) {
++$l;
$d = opendir($c);
while($f = readdir($d)) {
if(strpos($f, ".") === 0) continue;
$ff = $c . "/" . $f;
for($i=0;$i<$l;$i++) echo(" ");
echo("$ff\n");
if(is_dir($ff)) recurseDir($ff, $l + 1);
}
--$l;
}
recurseDir(".");
?>
Remove the header() call if you're running it from the command-line rather than a browser.
Bookmarks