How to do Recursive search in vbscript

No.of Views2452
Bookmarked0 times
Downloads 
Votes0
By  Rohan Datar   On  13 Sep 2010 08:09:19
Tag : VBScript , How to
It was this particular thing in vbscript which was luring me from many days. I had written a small script for downloading Test Cases from Quality Center to Excel
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

It was this particular thing in vbscript which was lurring me from many days. I had written a small script for downloading Test Cases from Quality Center to Excel. QC 9.5 provides this as in built functionality but we had some old systems where in we had to pull all existing cases in Excel. The code was ready and I found that it needed exact path from QC logical folder structure to find all cases within it. There was a dire need to search within the given path to find all sub folders and test cases within them.

There was another requirement to replace one particular string from many script files stored on a server where quality center was installed. I had to replace all scripts which get saved on qc file system which had a particular string present in it. All test cases of type QUICK_TEST get saved with Script.mts file holding the actual textual part of script.

Here is a snippet to find particular file type (e.g.: Here i have searched for .mts file type as it was our requirement) within given folder and it searches in all sub folders present in it:.

Code

strDir = "D:\rohan\test"Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDir = objFSO.GetFolder(strDir)RecursiveFunc (objDir)

Sub RecursiveFunc(Dir_Passed)
For Each Item_File In Dir_Passed.Files
If LCase(Right(CStr(Item_File.Name), 3)) = "mts" Thenwscript.Echo Dir_Passed & "\" & Item_File.Name
End IfNextFor Each Item_Fldr In Dir_Passed.SubFolders
'wscript.Echo Item_Fldr.Name & " recursed"RecursiveFunc (Item_Fldr)
NextEnd Sub

 Hope help.thank you reading.

 
Sign Up to vote for this article
 
About Author
 
Rohan Datar
Occupation-Not Provided
Company-Not Provided
Member Type-Fresh
Location-India
Joined date-13 Sep 2010
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
Comments
By:anandDate Of Posted:1/10/2011 6:49:17 AM
QC
I want the list of test case with unique id from QC through the vb script.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top