Hi,

this is venkatesh.
Q: I have 10 files in a folder(say D:\). Out of which there
are some .txt, .xls, .doc. I want to know how to get the
count of each file using qtp?

If U have any ans, plz write script for that...

Answer Posted / tvs ramakrishna chowdary

Dim filesys, demofolder, fil, filecoll, filist, ctr1, ctr2,
ctr3
ctr1 = 0
ctr2 = 0
ctr3 = 0
Set filesys = CreateObject("Scripting.FileSystemObject")
Set demofolder = filesys.GetFolder("E:\mk")
Set filecoll = demofolder.Files
For Each fil in filecoll
x= fil.name


If filesys.getExtensionName("E:\mkt\" &x) = "txt"
Then
ctr1 = ctr1+1
msgbox "total text files:"&ctr1
End If

If filesys.getExtensionName("E:\mkt\" &x) ="xls"
Then
ctr2 = ctr2+1
msgbox "total excel files are:"&ctr2
End If

If filesys.getExtensionName("E:\mkt\" &x) ="doc"
Then
ctr3 = ctr3+1
msgbox "total word files are:"&ctr3
End If
msgbox x
Next
msgbox("The count for Text files is: " & ctr1 & " The
countfor Excel files is: " & ctr2 &" The count for Word
files is: " & ctr3 )

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

hi can anybody help with an qtp 9.2 license key please. Thanks, Nitesh.

1851


How to handle dynamic objects in quicktest professional (qtp)?

554


How can you identify the browser and its information using QTP script?

556


Can any one send me the QTP Basic Coding Samples?

1616


How many types of parameters are there?

549






How you can make an action as re-usable action?

666


I have developed and executed a script successfully, and saved the same to QC. When I tried to execute the script from QC, the script is not executing. What are the possible reasons?”

598


I am getting an error "failed to open the XML checkpoint result viewer" in result window,after clicking on "View XML checkpoint results".Someone suggest me settings,if any...

1469


How many types of parameters are available in quicktest professional (qtp)?

593


can test automation improve test effectiveness?

1491


Hi, How Accessibility checkpoint in QTP can be implemented in the test script?

1619


Explain about the test fusion report of quicktest professional?

539


desribe a situation where u faced a stressful situation and how did u cope with it

1415


Explain xml checkpoints.

614


How to get Traceability matrix from TD?

688