<?php
//Specify the path of your cd. PHP must have access on your drive for cd.
//It is working on me using Windows 2000 with php5 installed.
$path="d:/music/";
function showfiles($path){
if (substr($path,-1) <> "/")
$path=$path."/";
$file=scandir($path);
while (list($key, $val) = each($file)) {
if (filetype($path.$val)=="dir" && $val<>".." && $val<>".") {
$count++;
print "<font face=arial size=1 color=blue><b>".$count.". ".$path.$val."</b></font>\n";
showfiles($path.$val);
}elseif (filetype($path.$val)=="file") {
$mp3=explode(".",$val);
if (in_array("mp3",$mp3)||in_array("MP3",$mp3)){
$count1++;
print "<font face=arial size=1><b>".$count1.". ".$val."</b></font>\n";
}
}
}
}
?>
<html><title>Recursive MP3 List</title>
<body>
<pre>
<?php print showfiles($path);?>
</pre>
</body>
</html>