How to get Folder and Subfolder Name in QTP

    2
    32
    Spread the love
    • 1
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
      1
      Share

    Folder and Sub Folder in UFT

    How to get Folder and Subfolder Name in QTP or UFT:

    In this code, our objective is to make use of QTP(VB Script) command to get the folder and subfolder names.
    Say I have drive F, under which I have a folder called V1 and under V1 I have two more subfolders 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.
    The script in QTP to get Collection(names) of Subfolders in a Folder. Below script is to get Subfolders 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
    Don't miss out!
    Subscribe To Newsletter

    Receive top technical news, lesson ideas, travel tips and more!

    Invalid email address
    Give it a try. You can unsubscribe at any time.

    Spread the love
    • 1
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
      1
      Share

    2 COMMENTS

    LEAVE A REPLY

    Please enter your comment!
    Please enter your name here