发一个以前写的遍历文件夹中文的文件夹,或指定类型(文件名)的文件夹

时间:2021-09-05 12:44:41
<%
'
'--------------------------------------------------------------
'    Modules : IteratorFile
'    Description : connect database file
'    Version : beta 1.0
'    Script Written by never-online
'    last updated Date: 2005-6-22
'--------------------------------------------------------------
'    Copyright (C) 2005,2006 Miracle Tech. All rights reserved.
'    Web: http://www.never-online.net
'    Email: bluedestiny [at] 126 . com
'--------------------------------------------------------------
'    Depend file(s): const.asp
'
'--------------------------------------------------------------
Function iterateChineseFileName(fileFolder)
Set Folder=fso.getFolder(fileFolder)
Set FileSets=Folder.files
for Each f in FileSets
if re.test(f.name)=true then
response.Write f.path & "<br/>"
response.Flush
counter=counter+1
end if
if response.isclientconnected=false then response.End
next
Set SubFolder=Folder.SubFolders
For Each f in SubFolder
iterateChineseFileName(f.path)
Next
End Function
dim fso, re,fileFolder,counter
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set re=new RegExp
re.global=true
re.ignorecase=false
'--------------------------------------
'  pattern : file name ? or regular
'            expression
'--------------------------------------
re.pattern="^([/u0391-/uFFE5]+)/.(?:doc|txt)$"
fileFolder=server.mappath(".")
counter=1
iterateChineseFileName(fileFolder)
response.Write "total chinese file(s) " & counter & ""
%>