@mac_shinobi depends how snazzy you want it.
If you want the easiest and basic way, just add a count to the loop for showing subfolders.
So as it's doing the subfolders it'll count up, and then break out and do a recursive search of the next folders etc. (2 = "main level" + 1 sub etc)Code:Set FSO = CreateObject("Scripting.FileSystemObject") ListMyStuff FSO.GetFolder("C:\test"), 2 Sub ListMyStuff(Folder, HowManySubFolders) If HowManySubFolders > 0 then For Each Subfolder in Folder.SubFolders DoYourFileOutputStuff! HowManySubFolders = HowManySubFolders -1 ListMyStuff Subfolder, HowManySubFolders Next End if End Sub
If you want the snazzier way you can always do stuff like breaking filepaths down and counting \'s etc, or checking child/parent links etc.
There are currently 1 users browsing this thread. (0 members and 1 guests)