Here is the code to do what you need using filesystemobject and recursion
VB Code:
Private Sub Form_Activate() PrintMyJunk 1, "c:\Program Files" End Sub Public Sub PrintMyJunk(Level As Integer, MyDir As String) Dim fsObj As New FileSystemObject Dim myFolder As Folder For Each myFolder In fsObj.GetFolder(MyDir).SubFolders Select Case Level Case Is = 1 Debug.Print "Client = " & myFolder.Name Case Is = 2 Debug.Print "Category = " & myFolder.Name Case Is = 3 Debug.Print "Source = " & myFolder.Name Case Is = 4 Debug.Print "GUID = " & myFolder.Name End Select If Level < 4 Then PrintMyJunk Level + 1, myFolder.Path End If Next End Sub





Reply With Quote