Dim gb_filePath() '''xxx文件的具体全路径
Dim gb_fileName() '''xxx文件名
Dim gb_iCount
gb_iCount=0
''递归遍历文件夹 folderspec,包括子文件夹及文件。查找所有.xxx后缀的文件,记录到 gb_filePath 中
Function GetfilePathAndCount(ByVal folderspec)
Dim fso, f, ff,mrm
Dim iCount
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set fsf = f.SubFolders
Set ff = f.Files
For Each file in ff
Str = Right(file.name, 4)
If Str=".xxx" Then
gb_iCount=gb_iCount+1
ReDim Preserve gb_filePath(gb_iCount)
ReDim Preserve gb_fileName(gb_iCount)
gb_filePath(gb_iCount) = folderspec & "/"&file.name
gb_fileName(gb_iCount) = file.name
End If
Next
For Each subfolder in fsf
GetfilePathAndCount subfolder.Path
Next
Set f=nothing
Set fsf=nothing
Set fso=nothing
End Function