RecurseFolderList
This code is a modified version of ShowFolderList by Bruce Lindsay. (Thanx !!) This code will recursively parse a directory defined by an path parameter. My aim was to work around
the non-recursive nature of the dir function. Bruce's original code does that to one folder/child level. Mine now returns everything below a given path. You can still use getattr to define Folder or File attributes.
Inputs
foldername - "c:\temp"
Side Effects
No error trapping, untested on VB3/4
Rate RecurseFolderList
(3(3 Vote))
Function RecurseFolderList(foldername)
Dim fso, f, fc, fj, f1
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(foldername)
Set fc = f.Subfolders
Set fj = f.Files
'For each subfolder in the Folder
For Each f1 In fc
'Do something with the Folder Name
debug.print f1
'Then recurse this function with the sub-folder to get any sub-folders
RecurseFolderList(f1)
Next
'For each folder check for any files
For Each f1 In fj
debug.print f1
Next
End Function
RecurseFolderList Comments
No comments yet — be the first to post one!
Post a Comment