If the UDF doesn't do what you want and you need to re-engineer, here's a simple example to get you started:
Code:
Break ON
$=SetOption("Explicit","ON")
$=SetOption("WrapAtEOL","ON")

$=funRecurse("C:\",3)

Function funRecurse($sDir,$iLevel)
Dim $sEntry

$iLevel=$iLevel-1
$sEntry=Dir($sDir)
While Not @ERROR
If NOT($sEntry="" OR $sEntry="." OR $sEntry="..")
$sEntry=$sDir+"\"+$sEntry
""+$iLevel+": "+$sEntry+@CRLF
If (GetFileAttr($sEntry) & 16) AND $iLevel
funRecurse($sEntry,$iLevel)
EndIf
EndIf
$sEntry=Dir()
Loop
EndFunction