PDA

View Full Version : [SOLVED:] Count number of files in a folder



YasserKhalil
07-07-2010, 02:22 PM
Hi everyone,

I'd like to write a code to count the number of files containing certain letters (e.g. *ABC*) in a folder that I specify by pathname

Bob Phillips
07-07-2010, 02:35 PM
Dim file As Object
Dim fileCount As Long
With CreateObject("Scripting.FileSystemObject").getfolder("C:\test\")
For Each file In .Files
If file.Name Like "ABC*" Then
fileCount = fileCount + 1
End If
Next file
End With
MsgBox fileCount

YasserKhalil
07-07-2010, 02:54 PM
Thanks a lot
I'm very happy to be a member in this wonderful forum