-
Contributing Member
I have 10 files in a folder(say D:\). Out of which there
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?
-
Junior Member
Re: I have 10 files in a folder(say D:\). Out of which there
Hi Suneetham,
Please find the below code for the count particular file type.Insert the respective file extension & path.
Dim fso, f,f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("C:\Documents and Settings\user\Desktop\New Folder")
Set fc = f.Files
For Each f1 In f.Files
If LCase(Right(f1.name, 4)) = ".doc" Then
b=f1.name
msgbox b
end if
Thanks,
MaluR
next
-
Expert Member
Re: I have 10 files in a folder(say D:\). Out of which there
Here you can find the count of the files....
Set fso = createobject("scripting.filesystemobject")
set fold = fso.getfolder("d:\testing files")
set fc = fold.files
word=0
xls=0
txt=0
datatable.getsheet(1).addparameter"word",""
datatable.getsheet(1).addparameter"excel",""
datatable.getsheet(1).addparameter"text",""
datatable.gdtsteet(1).addparameter"Total Files",""
for each f in fold.files
if lcase(right(f.name, 4)) = ".doc" then
word=word+1
end if
if lcase(right(f.name,4))=".xls" then
xls=xls+1
end if
if lcase(right(f.name,4))=".txt" then
txt=txt+1
end if
next
datatable(1,1)=word
datatable(2,1)=xls
datatable(3,1)=txt
datatable(4,1)=fc.count
run and see the runtime datatable.
Last edited by rajaputra; 02-18-2008 at 11:52 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules