Hi forum members!
This code below count the number of txt files.
What should be changed to count files containing specific string in a filename?
Thx in advice
This code below count the number of txt files.
What should be changed to count files containing specific string in a filename?
Code:
Option Explicit
Dim fso, count, src, folder, file
Set fso = CreateObject("Scripting.FileSystemObject")
src = "C:\Users\Mark\Desktop\test"
Set folder = fso.GetFolder(src)
count = 0
For Each file In folder.files
If LCase(fso.GetExtensionName(file)) = "txt" Then
count = count + 1
End If
Next
WScript.Echo "Count: " & count
Thx in advice