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

Answers were Sorted based on User's Feedback



Hi, this is venkatesh. Q: I have 10 files in a folder(say D:\). Out of which there are some ...

Answer / bathi

set fso=createobject("scripting.filesystemobject")
set objfolder=fso.getfolder("XXX")

set fil=objfolder.files

for each fils in fil
fils1=fils1&fils.name
next

xls=split(fils1,".xls")
msgbox ubound(xls)

doc=split(fils1,".doc")
msgbox ubound(doc)

txt=split(fils1,".txt")
msgbox ubound(txt)

I guess, this will work........
Good Day........

Is This Answer Correct ?    5 Yes 0 No

Hi, this is venkatesh. Q: I have 10 files in a folder(say D:\). Out of which there are some ...

Answer / balu

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

If filesys.getExtensionName("c:\QTPtest\" & fil.Name) =
"txt" Then
ctr1 = ctr1+1
End If

If filesys.getExtensionName("c:\QTPtest\" & fil.Name) =
"xls" Then
ctr2 = ctr2+1
End If

If filesys.getExtensionName("c:\QTPtest\" & fil.Name) =
"doc" Then
ctr3 = ctr3+1
End If

'filist = fil.name
'filist = filist & " "
Next
msgbox("The count for Text files is: " & ctr1 & " The count
for Excel files is: " & ctr2 &" The count for Word files
is: " & ctr3 )

take and pandugachesukoooo....(if you r tulugu people you
can understood pandu... cool)

Is This Answer Correct ?    4 Yes 1 No

Hi, this is venkatesh. Q: I have 10 files in a folder(say D:\). Out of which there are some ...

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

Hi, this is venkatesh. Q: I have 10 files in a folder(say D:\). Out of which there are some ...

Answer / chowdary

hi balu and bathi good work .........
thnks........

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More QTP Interview Questions

What is recovery scenario in qtp?

0 Answers  


Is it possible to switch between recording modes during a test creation?

0 Answers  


Where can i get the QTP tutorials. I wanna move to automation testing. Is there any book or URL, where i can find the source to read...

1 Answers  


Write a user defined function to count the no. of buttons existed in a webpage ? i dont want to use descriptive.create ()

1 Answers  


Error handling

3 Answers   Wipro,






Explain advantages and disadvantages of ddf?

0 Answers  


I am using descriptive programming for my project.when QTP deosn't identity or recognize a object by record and playback method,is it possible to make QTP identify that object using descriptive programming? Note: The object doesn't have unique properties and same properties used in Record and playback are only available, no extra properties are defined.

3 Answers  


I created 3 actions in test suppose I want to run action 1 in single time, action 2 is 4 time what I do?

0 Answers  


Explain how to use QTP to check broken links on a page?

0 Answers  


Browser("Las Vegas Hotels - Las").Page("Vegas Hotels - Hotels").Link("Luxor") ......here Luxor is a hotel and this is recognised as a link. I have many hotels like Luxor, Palms etc which are all displayed as link...How do I parametrize this by using webtable functions??? ASAP

1 Answers   HP,


Could any one explain about the nested actions in QTP? This question is asked by Qualitree and CA

3 Answers   CA, Qualtree Solutions,


How can I import environment from a file on disk?

0 Answers  


Categories