Friday, June 6, 2008

How to get the Count of each file in a particual folder

Set fso = CreateObject("Scripting.FileSystemObject")
Set fold = fso.getFolder("D:\testingfiles")
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.getSheet(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 this script and see the runtime datatable

No comments:

About Me

My photo
Hi all,I am Arun Singh Rajaputra. I am working as a Project Lead in a reputed organization in Hyderabad, AP, India. I have little bit knowledge on Quick Test Professional and like to share my knowledge to all through this blog.

Subscribe to get updates on this blog

Enter your email address:

NOTE

Some of the posts posted in this blog are collected and most of them have been prepared by me. If any one have objections regarding any copied posts. Please mail me so that I can take a necessary action on that post.