well I found this code snipplet
It prints all subdirectories of a directory. Hope it helps
<?
This function opens a directory, and prints them out
function parse_dir($dir,$level){
print $dir.\" (DIR)<BR>\n\";
$dp=opendir($dir);
while (false!=($file=readdir($dp))){
if ($file!=\".\" && $file!=\"..\"){
if (is_dir($dir.\"/\".$file)) parse_dir($dir.\"/\".$file,$level+1);
else print $dir.\"/\".$file.\"<BR>\n\";
}
}
}
$start_dir=\"/www/htdocs\";
$level=1;
parse_dir($start_dir,$level);
?>