[vb]代码库
Private Sub iCount(ByVal fileFolder As String, ByVal fileSuffix As String)
On Error Resume Next
Dim sSave As String, Ret As Long, r As Long, rtn As Long, iFile As Long
Dim fol, fso, fil, fils, s, f, fldr
Set fso = CreateObject("Scripting.FileSystemObject")
Set fldr = fso.GetFolder(fileFolder) '文件夹名字及路径
Set fils = fldr.Files
iFile = 0
Me.Cls
For Each fil In fils
s = s & fil.Name
aa = midstr & "\" & fil.Name
If Right(aa, 7) = fileSuffix Then
songname = aa
i = InStrRev(songname, "\")
If i > 0 Then
bb = Mid(songname, i + 1) ' 获取文件名
Print bb
iFile = iFile + 1
End If
End If
Next
MsgBox "共有" & Str(iFile) & " 个" & fileSuffix & "文件"
End Sub