Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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

Hi, Can any one explain what is mean by Driver Script? is it AOM?

4 Answers   CTS,


I have a list box which contains duplicate values e.g. A,A,A,B,B,B,C,C,C.Now write a code in qtp to test the list box . Scenario #1 : I have to check whether any values are there? Scenario #2 : If duplicate values are there,then how many time it is getting duplicated? Svenario #3 : how can I test presence of items in list box ommiting duplicate values?

6 Answers   NIIT,


In a webtable, lets say there are 10 records and 1 column. let say "image" is available for 1st,2nd and 3rd records and 4th onwards image is not available. How to recognise for that cell image is available or not?

2 Answers  


how to retrieve the xml file data through qtp. can anybody send script for this..

2 Answers   Synechron,


For example one window is there the window contain some of Check boxes but my question is how many check boxes are there particular window? Please solve the problem gi_raju@rediffmail.com ippaliraju@yahoo.co.in

3 Answers  






Can anyone pls tell me how to do action parameterization (input and output parameters) with respect to login window and insert order of flight reservation window in detail( pls give a clear step by step explanation with example) anyone please. Will be very thankful to u

0 Answers   Avenger Software,


What do you mean by checkpoints in qtp?

0 Answers  


How can I replace all the text from the QTP script with some other text.

1 Answers   Livetek,


In my QTP script I have a word in notepad that ends in a question mark, for example... "father?" As part of my script I want to delete the question mark. How do you delete a character in notepad?

4 Answers  


How to associate function library at a run time?

0 Answers  


Step 3&4 are repeated until an the object in recognised uniquely.

0 Answers  


what is localisation testing and globalisation testing? what is the difference between them?

1 Answers   CDC Software,






Categories