VBScript to count the total number of files in a folder of the same extension
kw.vbs
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("D:\VBScript")
counter = 0
For Each File In objFolder.Files
    If objFSO.GetExtensionName(File) = "txt" Then
        counter = counter + 1
    End If
Next
print "Total txt File " & counter
Output

Total Files 15

Advertisement