-
Again!
How many times am i going to have to post the same bit of code? Does anyone actually bother doing a search for the answer to their question.
Now i have got that out of my system here is how you get a list of sub-dirs.;)
Code:
Option Explicit
Dim fso
Dim myOutFile
Private Sub Command2_Click()
Dim myFolder
'create a file scripting object
Set fso = CreateObject("Scripting.FileSystemObject")
'the output file
Set myOutFile = fso.createtextfile("FileList.txt")
myFolder = "c:\program files"
getFolderNames (fso.getfolder(myFolder).subfolders)
myOutFile.Close
End Sub
Private Sub getFolderNames(myFolderList)
Dim myFolder
For Each myFolder In myFolderList
myOutFile.writeline myFolder.Path
'recursivley get sub folders.
getFolderNames (fso.getfolder(myFolder).subfolders)
Next
End Sub
Hope this helps.