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
Explain the differences between table and db checkpoints?
wht type of User defined functions or Java Releated functions Do we write in VB scripting
your coming from electrical backgroung..but y ur coming to software side?
How to test fly out menu in qtp?
Explain QTP using different development techniques ?
i need code for how to click on particular mail in utlook mail box .its urjent Thank You Balaji
Please guide me release notes of Automation once scripts are completed
Hi, my requirement is to make a query in SQL using QTP. And i have to get the results of that query and i have to use those results for future testing. I created a driver but i dont know the code for using this Driver. please help me by providing the solution for y requorement
What is the difference between call to existing action and copy of an action?
How to integrate the qualitycenter with qtp
What is the difference between qtp and selenium?
How to data driven test for Win objects in QTP ?
Is it possible to switch between recording modes during a test creation?
What is the basic concept of qtp?
I have many listboxes in my application. I have to check whether the contents inside the listboxes are in sorted order or not..can anyone please send the code as early as possible