<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
dim st
st=timer()
'*************************************************************
'***************Search hard disk file class SearchFile ************
'************ Call method: ************
'************Set newssearch=new SearchFile 'Declaration ************
'***************="F:+E:"'Passed in search source*************
'***************="Compilation" 'Keywords*********
'************ 'Start search************
'************Set newssearch=Nothing 'end*************
'************Copyright(c)Looking at the moon and the moon ************
'*************http://btyz./ *************
'*************************************************************
Class SearchFile
dim Folders 'Passing an absolute path, multipath uses + sign to connect, no spaces
dim keyword 'Passing keywords
dim objFso 'Define global variables
dim Counter 'Define global variables, the number of search results
'*****************initialization**************************************
Private Sub Class_Initialize
Set objFso=("")
Counter=0 'Initialize the counter
End Sub
'************************************************************
Private Sub Class_Terminate
Set objFso=Nothing
End Sub
'****************** Public member, method called *******************************
Function Search
Folders=split(Folders,"+") 'Convert to array
keyword=trim(keyword) 'Remove the spaces before and after
if keyword="" then
("<font color='red'> keyword cannot be empty</font><br/>")
exit Function
end if
'Just determine whether illegal characters are included
flag=instr(keyword,"\") or instr(keyword,"/")
flag=flag or instr(keyword,":")
flag=flag or instr(keyword,"|")
flag=flag or instr(keyword,"&")
if flag then 'The keyword cannot contain \/:|&
("<font color='red'> keyword cannot contain /\:|&</font><br/>")
Exit Function 'If this is included, exit
end if
'Multi-path search
dim i
for i=0 to ubound(Folders)
Call GetAllFile(Folders(i)) 'Call loop recursive function
next
("A total of <font color='red'>"&Counter&"</font> results were found")
End Function
'******************************************
Private Function GetAllFile(Folder)
dim objFd,objFs,objFf
Set objFd=(Folder)
Set objFs=
Set objFf=
'Travel through subfolders
dim strFdName 'Declare the subfolder name
'************Visit subfolders*******
on error resume next
For Each OneDir In objFs
strFdName=
'The system folder is not included in the traversal
If strFdName<>"" EQV strFdName<>"RECYCLED" EQV strFdName<>"RECYCLER" EQV strFdName<>"System Volume Information" Then
SFN=Folder&"\"&strFdName 'Absolute path
Call GetAllFile(SFN) 'Call recursion
End If
Next
dim strFlName
'************Vide to the file**********
For Each OneFile In objFf
strFlName=
' and not in the column range
If strFlName<>"" EQV strFlName<>"" Then
FN=Folder&"\"&strFlName
Counter=Counter+ColorOn(FN)
End If
Next
'***************************
'Close each object instance
Set objFd=Nothing
Set objFs=Nothing
Set objFf=Nothing
End Function
'*************************** Generate matching pattern******************************************
Private Function CreatePattern(keyword)
CreatePattern=keyword
CreatePattern=Replace(CreatePattern,".","\.")
CreatePattern=Replace(CreatePattern,"+","\+")
CreatePattern=Replace(CreatePattern,"(","\(")
CreatePattern=Replace(CreatePattern,")","\)")
CreatePattern=Replace(CreatePattern,"[","\[")
CreatePattern=Replace(CreatePattern,"]","\]")
CreatePattern=Replace(CreatePattern,"{","\{")
CreatePattern=Replace(CreatePattern,"}","\}")
CreatePattern=Replace(CreatePattern,"*","[^\\\/]*") '* number matches
CreatePattern=Replace(CreatePattern,"?","[^\\\/]{1}") '? number matching
CreatePattern="("&CreatePattern&")+" 'Overall Match
End Function
'****************************** Search and color keywords ****************************
Private Function ColorOn(FileName)
dim objReg
Set objReg=new RegExp
=CreatePattern(keyword)
=True
=True
retVal=(FileName) 'Check the search test, if it passes, color and output
if retVal then
OutPut=(FileName,"<font color='#FF0000'>$1</font>") 'Set the display color of the keyword
'****************************** This part can modify the output as needed******************************************************
OutPut="<a href='#'>"&OutPut&"</a><br/>"
(OutPut) 'Output matching result
'*********************************************************************
ColorOn=1 'Number of added counters
else
ColorOn=0
end if
Set objReg=Nothing
End Function
End Class
'****************************** End class SearchFile*********************
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Media Search</title>
</head>
<body>
<form name="form1" method="post" action="<% =("PATH_INFO")%>">
Keywords:
<input name="keyword" type="text" >
<input type="submit" name="Submit" value="Search">
<a href="" target="_blank">Advanced Search Help</a>
</form>
<%
dim keyword
keyword=("keyword")
if keyword<>"" then
Set newsearch=new SearchFile
="E:\Media+F:"
=keyword
Set newsearch=Nothing
("<br/>Time-consuming: "&(timer()-st)*1000&"ms")
end if
%>
</body>
</html>
<%
dim st
st=timer()
'*************************************************************
'***************Search hard disk file class SearchFile ************
'************ Call method: ************
'************Set newssearch=new SearchFile 'Declaration ************
'***************="F:+E:"'Passed in search source*************
'***************="Compilation" 'Keywords*********
'************ 'Start search************
'************Set newssearch=Nothing 'end*************
'************Copyright(c)Looking at the moon and the moon ************
'*************http://btyz./ *************
'*************************************************************
Class SearchFile
dim Folders 'Passing an absolute path, multipath uses + sign to connect, no spaces
dim keyword 'Passing keywords
dim objFso 'Define global variables
dim Counter 'Define global variables, the number of search results
'*****************initialization**************************************
Private Sub Class_Initialize
Set objFso=("")
Counter=0 'Initialize the counter
End Sub
'************************************************************
Private Sub Class_Terminate
Set objFso=Nothing
End Sub
'****************** Public member, method called *******************************
Function Search
Folders=split(Folders,"+") 'Convert to array
keyword=trim(keyword) 'Remove the spaces before and after
if keyword="" then
("<font color='red'> keyword cannot be empty</font><br/>")
exit Function
end if
'Just determine whether illegal characters are included
flag=instr(keyword,"\") or instr(keyword,"/")
flag=flag or instr(keyword,":")
flag=flag or instr(keyword,"|")
flag=flag or instr(keyword,"&")
if flag then 'The keyword cannot contain \/:|&
("<font color='red'> keyword cannot contain /\:|&</font><br/>")
Exit Function 'If this is included, exit
end if
'Multi-path search
dim i
for i=0 to ubound(Folders)
Call GetAllFile(Folders(i)) 'Call loop recursive function
next
("A total of <font color='red'>"&Counter&"</font> results were found")
End Function
'******************************************
Private Function GetAllFile(Folder)
dim objFd,objFs,objFf
Set objFd=(Folder)
Set objFs=
Set objFf=
'Travel through subfolders
dim strFdName 'Declare the subfolder name
'************Visit subfolders*******
on error resume next
For Each OneDir In objFs
strFdName=
'The system folder is not included in the traversal
If strFdName<>"" EQV strFdName<>"RECYCLED" EQV strFdName<>"RECYCLER" EQV strFdName<>"System Volume Information" Then
SFN=Folder&"\"&strFdName 'Absolute path
Call GetAllFile(SFN) 'Call recursion
End If
Next
dim strFlName
'************Vide to the file**********
For Each OneFile In objFf
strFlName=
' and not in the column range
If strFlName<>"" EQV strFlName<>"" Then
FN=Folder&"\"&strFlName
Counter=Counter+ColorOn(FN)
End If
Next
'***************************
'Close each object instance
Set objFd=Nothing
Set objFs=Nothing
Set objFf=Nothing
End Function
'*************************** Generate matching pattern******************************************
Private Function CreatePattern(keyword)
CreatePattern=keyword
CreatePattern=Replace(CreatePattern,".","\.")
CreatePattern=Replace(CreatePattern,"+","\+")
CreatePattern=Replace(CreatePattern,"(","\(")
CreatePattern=Replace(CreatePattern,")","\)")
CreatePattern=Replace(CreatePattern,"[","\[")
CreatePattern=Replace(CreatePattern,"]","\]")
CreatePattern=Replace(CreatePattern,"{","\{")
CreatePattern=Replace(CreatePattern,"}","\}")
CreatePattern=Replace(CreatePattern,"*","[^\\\/]*") '* number matches
CreatePattern=Replace(CreatePattern,"?","[^\\\/]{1}") '? number matching
CreatePattern="("&CreatePattern&")+" 'Overall Match
End Function
'****************************** Search and color keywords ****************************
Private Function ColorOn(FileName)
dim objReg
Set objReg=new RegExp
=CreatePattern(keyword)
=True
=True
retVal=(FileName) 'Check the search test, if it passes, color and output
if retVal then
OutPut=(FileName,"<font color='#FF0000'>$1</font>") 'Set the display color of the keyword
'****************************** This part can modify the output as needed******************************************************
OutPut="<a href='#'>"&OutPut&"</a><br/>"
(OutPut) 'Output matching result
'*********************************************************************
ColorOn=1 'Number of added counters
else
ColorOn=0
end if
Set objReg=Nothing
End Function
End Class
'****************************** End class SearchFile*********************
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Media Search</title>
</head>
<body>
<form name="form1" method="post" action="<% =("PATH_INFO")%>">
Keywords:
<input name="keyword" type="text" >
<input type="submit" name="Submit" value="Search">
<a href="" target="_blank">Advanced Search Help</a>
</form>
<%
dim keyword
keyword=("keyword")
if keyword<>"" then
Set newsearch=new SearchFile
="E:\Media+F:"
=keyword
Set newsearch=Nothing
("<br/>Time-consuming: "&(timer()-st)*1000&"ms")
end if
%>
</body>
</html>