Unified Functional Testing Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

Record file system using QTP

Go to Solution

Record file system using QTP



I am trying to search a specific folder in D:\test directory using QTP. I did spy on the folders. It seems to me all the folders in a containter object. QTP does not recognize folders seperately. Any help?



Honored Contributor

Re: Record file system using QTP

What version of QTP are you using?

Are you using QTP to interact with a Windows Explorer dialog, or are you using vbscript code to interact with the file system?
[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)

Re: Record file system using QTP

I am using qtp 11.


Not sure what to answer to your question.


Example: In C:\Test directory, folders are being created automatically from a VB application. Each time VB application creates a folder, I need to come to C directory to verify whether the folder was created.


Folders names will be test1, test2, test3, qtp1, qtp2, qtp3.


When a new folder gets created with prefix test, the next folder name will be test4. When a new folder gets created with prefix qtp, the fourth qtp folder name will be qtp4, so on.


I need QTP to find out whether the new folder has created with the same prefix in the given directory.


HPE Expert

Re: Record file system using QTP



    You can use filesystem to get that.


Set fso=createobject("Scripting.FileSystemObject")
'Folder  for  getting details  
Set get_folder=fso.GetFolder(Sourcefolder) 
'get the subfolders count in a folder
Set  get_subfolder=get_folder.SubFolders
For  each  folder  in get_subfolder
'compare folder name
If folder.name = "expected value" then
'process to do
end if 
Set fso=nothing


If you find that this or any post resolves your issue, mark it as an accepted solution.


The code provided above is free and is just a sample, you need to adapt it and maintain it according to your needs.


Also remember if you have a valid contract with HP feel free to visit our FT/QTP Support Customer Forums:




You can create an account with your HP credentials