Hier eine VB-Antwort:
Man nehme eine Form mit folgenden Controls…
DirListBox … Dir1
ListBox … List1
CommandButton … Command1
Das Beispiel habe ich mal im Internet gefunden … das kannst Du Dir dann ja auf Deine Bedürfnisse „zuschneidern“.
greets from michL (Vienna)
Private Sub Command1\_Click()
ReDim sArray(0) As String
Dim l As Long
'
Call DirWalk("d:\datenns\download", sArray)
'
MsgBox "Fertig: " & UBound(sArray)
'
For l = 0 To UBound(sArray)
Call Me.List1.AddItem(sArray(l))
Next l
'
End Sub
'
'
'
Sub DirWalk(ByVal strCurDir As String, strFound() As String)
Dim i As Integer
Dim strCurrPath As String
Dim iLen As Integer
'
If Right$(strCurDir, 1) "\" Then
Dir1.Path = strCurDir & "\"
Else
Dir1.Path = strCurDir
End If
'
For i = 0 To Dir1.ListCount
If Dir1.List(i) "" Then
'DoEvents
Call DirWalk(Dir1.List(i), strFound())
Else
If Right$(Dir1.Path, 1) = "\" Then
strCurrPath = Left(Dir1.Path, Len(Dir1.Path) - 1)
Else
strCurrPath = Dir1.Path
End If
'
ReDim Preserve strFound(UBound(strFound) + 1)
strFound(UBound(strFound) - 1) = strCurrPath
'
iLen = Len(Dir1.Path)
Do While Mid(Dir1.Path, iLen, 1) "\"
iLen = iLen - 1
Loop
Dir1.Path = Mid(Dir1.Path, 1, iLen)
End If
Next i
End Sub