Search This Blog

Tuesday, January 18, 2011

Getting the number of files with same extension in a folder

Flag = 0
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sPath) 'Path of the folder
Set oFile = oFolder.Files
For each sFile in oFile
Pos = Instr(1,sFile.name,".jpeg",1) ' change the extn as required.
If Pos <> 0 Then
Flag =Flag +1
End If
Next
msgbox Flag

No comments:

Post a Comment