VBScript to count the total number of files in a folder of the same extension
gd.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
Comments and Reactions
What Next?
VBScript to read and write the data in a text file
VBScript to format the text in a Word document
VBScript to create an Excel in one folder and paste into another folder
Advertisement