Puoi fare cosi....

codice:
<? 
function checkDir($shift,$rep,$num) {
 $open= @OpenDir($rep);
 while($image=@ReadDir($open)) {
  if(($image!=".")&&($image!="..")) {
	 $repertoire = $rep."/".$image;
	 $repname    = $image;
	 $selected   = "$shift/$image" == $GLOBALS['repert'] ? "selected" : "";
   if (is_dir($repertoire )) {
	  //print str_repeat("", $num);?>
		<option value="<? print "$shift/$image" ?>" <? print $selected ?>><? print $repertoire ?></option>
		<?
	  checkDir("$shift/$image",$repertoire,$num+3);
	 } // if (is_dir( $image)) {
	} // if(($image!=".")&&($image!="..")) {
 } // while($image=@ReadDir($open)) 
} // function checkDir($shift,$rep,$num)

function checkDir2($shift,$rep,$num) {
 $open= @OpenDir($rep);
 while($image=@ReadDir($open)) {
  if(($image!=".")&&($image!="..")) {
	 $repertoire = $rep."/".$image;
	 $repname    = $image;
   if (is_dir($repertoire )) {
	  $deplac = str_repeat("-", $num);
	  print "
|$deplac$repertoire"; 
	  checkDir2("$shift/$image",$repertoire,$num+3);
	 } // if (is_dir( $image)) {
	} // if(($image!=".")&&($image!="..")) {
 } // while($image=@ReadDir($open)) 
} // function checkDir2($shift,$rep,$num)
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<body>
<select >
 <? checkDir("  ","C:/TEMP",1) ?>
</select>


 <? checkDir2("  ","C:/TEMP",1) ?>

</body>
</html>