<%
strText = Request("SearchText")
Const fsoForReading = 1
Dim objFile, objFolder, objSubFolder, objTextStream
strFile = ".asp .htm .html .txt .css"
strRoot = "/"
bolFileFound = False
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(Server.MapPath(strRoot))
response.Write("<table><tr><td>文件名</td><td>最后修改时间</td><td>文件大少</td></tr>")
schSubFol(objFolder)
response.Write("</table>")
function schSubFol(objFolder)
For Each objFile in objFolder.Files
if (instr(strFile,mid(objFile.Name,InstrRev(objFile.Name,".")+1))) then
Set objTextStream = objFSO.OpenTextFile(objFile.Path,fsoForReading)
strContent = objTextStream.ReadAll
If instr(strContent,strText) then
objFilePath=mid(objFile.Path,InstrRev(objFile.Path,"/")+1)
Response.Write "<tr><td> " &objFilePath & "</td><td> " & FormatDateTime(objFile.DateLastModified,1) & "</td><td> " & FormatNumber(objFile.Size / 1024) & "Kbytes</td><tr>"
bolFileFound = True
End If
objTextStream.Close
end if
Next
End function
For Each objSubFolder in objFolder.SubFolders
schSubFol(objSubFolder)
Next
Set objTextStream = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
%>