Header Ads

How to get Folder and Subfolder Name in QTP

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 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 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














Powered by Blogger.