<%
Const fsoForReading = 1
Dim strbusca_palabra
strbusca_palabra = Request("busca_palabra")
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Dim objFolder
Set objFolder = objFSO.GetFolder(Server.MapPath("/public"))
response.write objFolder & "<BR>"
Dim SubFolders
Set SubFolders = objFolder.SubFolders
Dim objFile, objTextStream, strFileContents, bolFileFound
bolFileFound = False
i = 0
For Each objFolder1 in SubFolders
i = i + 1
if i <> 1 then
Set objFolder = objFSO.GetFolder(Server.MapPath("/public" & objFolder1.name))
end if
For Each objFile in objFolder.Files
If Response.IsClientConnected then
Set objTextStream = objFSO.OpenTextFile(objFile.Path,fsoForReading)
strFileContents = objTextStream.ReadAll
on error resume next
If InStr(1,strFileContents,strbusca_palabra,1) then
if i <> 1 then
Response.Write "<LI><A HREF=" & objFolder1.name & "/" & objFile.Name & ">" & objFile.Name & "</A><BR>"
else
Response.Write "<LI><A HREF=" & objFile.Name & ">" & objFile.Name & "</A><BR>"
end if
bolFileFound = True
End If
objTextStream.Close
End If
Next
Next
if Not bolFileFound then Response.Write "No se encontraron resultados<br><a href='javascript:;history.back(-1)'>Intentar nuevamente</a>"
Set objTextStream = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
Set SubFolders = Nothing
%>