用asp实现的获取文件夹中文件的个数的代码

复制代码 代码如下:

  '返回指定文件夹中文件的数目,传入值为被检测文件夹的硬盘绝对路径

  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