FileSystemObject

J

Jose

How cani I get the list of folders using FileSystemObject?

I can get the folders list until one level down, for example:

I have the following folders:

C:\BLK2DB
AllocSyst
Files
XML
Excel
DB_PASM
Files
Chemicals

I use the following code to get the list folders


Sub ShowFolderList()
Dim strPath As String
strPath = "C:\BLK2DB"

Dim fs, f, f1, fc, s, fr
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(strPath)
Debug.Print f

Set fc = f.SubFolders
For Each f1 In fc
s = s & f1.Name
s = s & vbCrLf
Next
Debug.Print s
End Sub


The results are:
AllocSyst
DB_PASM
Chemicals

I would like to get all folders

Is is possible?

Thanks,
Jose
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top