Say I have drive F ,under which I have a folder called V1 and under V1 I have two more sub folders called Sub Folder-v2 and v3.
Now to execute from a specific location and store result files it is very much important to get the folder name dynamically.
This article talks about the code to fetch all the information required.
Script in QTP to get Collection(names) of Sub folders in a Folder.Below script is to get Sub folders names in Folder V1Where Folder V1 is in F drive.
Dim a,b, c, d, e Set a = CreateObject("Scripting.FileSystemObject") Set b = a.GetFolder("F:\V1") Set c = b.SubFolders For Each d in c e=e&d.name&vbnewline Next msgbox e