全站搜索

<%
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
%>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值