'返回指定文件夹中文件的数目,传入值为被检测文件夹的硬盘绝对路径 function CountFilesNumber(folderspec) Dim objfso,f,fc Set objfso=CreateObject("Scripting.FileSystemObject") Set f=objfso.GetFolder(folderspec) Set fc=f.Files CountFilesNumber=fc.Count set fc=nothing set f=nothing set objfso=nothing End Function