Protected by Copyscape
Powered By Blogger

Friday, January 17, 2020

How to count number of files in a folder?

Assume there is a folder named 'abc' in C drive and we need to get the count of all the files with in the folder

Dim objFso

Set objFso=CreateObject("Scripting.FileSystemObject")
Set Folder=objFso.GetFolder("C:/abc")
Set NoOfFiles=Folder.Files
Msgbox NoOfFiles.count

Set objFso=Nothing

No comments: