Function UnMapPath( Path )
UnMapPath = Replace(Mid(Path, Len(Server.MapPath("/")) + 1), "\", "/")
End Function
Function SearchFile( f, s, title )
Dim fo
Dim content
Dim pos1,pos2
On Error Resume Next
Set fo = fs.OpenTextFile(f)
content = fo.ReadAll
fo.Close
SearchFile = InStr(1, content, S, vbTextCompare) > 0
If SearchFile Then
pos1 = InStr(1, Lcase(content), Lcase(KeyStart), vbTextCompare)
pos2 = InStr(1, Lcase(content), Lcase(KeyEnd), vbTextCompare)
title = ""
If pos1 > 0 And pos2 > 0 Then
title = Mid( content, pos1 + LenKey, pos2 - pos1 - LenKey )
End If
End If
If Err Then
Response.Write ("<font color=red><B>")
Response.Write ("Error #" & CStr(Err.Number) & "" & Err.description )
Response.Write ("该文件名称为:" & f.Name & "<br>" & VbCrlf)
Response.Write ("</B></font>" & VbCrlf)
Else
Response.Write ("<font color=#000000>")
Response.Write ("Error #" & CStr(Err.Number) & "" & Err.description )
Response.Write ( f.name & "在正常运行<br>" & VbCrlf)
Response.Write ("</font>" & VbCrlf)
End If
End Function
Function FolderLink( fd )
Dim vPath
vPath = UnMapPath( fd.Path )
FolderLink = "<A HREF=""" & vPath & """>" & vPath & "</A>"
FolderLink = "<IMG SRC=" & FolderImg & " Align=TextTop> "& FolderLink
End Function
Function FileLink( f, title )
Dim vPath
vPath = UnMapPath( f.Path )
If title = "" Then title = f.Name
FileLink = "<A HREF=""" & vPath & """>" & title & "</A>"
FileLink = "<UL><IMG SRC=" & FileImg & " Align=TextTop> " & FileLink & "</UL>"
End Function
Sub SearchFolder( fd, s )
Dim found
Dim pos
Dim ext
Dim f
Dim sfd
Dim Title
found = False
For each f In fd.Files
pos = InStrRev(f.Path, "." )
If pos > 0 Then
ext = Mid(f.Path, pos + 1 )
Else
ext = ""
End If
If LCase(ext) = LCase(FileType) Then
If SearchFile( f, s, title ) Then
If found = False Then
found = True
Response.Write FolderLink(fd) & "<P>"
End If
Response.Write FileLink(f, title)
End If
End If
Next
For each sfd In fd.SubFolders
SearchFolder sfd, s
Next
End Sub
%>
<html>