Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FSO Search on Parent Folder 2

Status
Not open for further replies.

ColonelBlue

Technical User
Jun 24, 2004
110
US
Hello.
Not sure if this is the right place to ask.

I am not an FSO expert by any means and we have been using a script to generate folder content listing on an asp page.
I am looking for a simple FSO search script that would be run on the parent folder for users to search for relevant files with a particular file name?
Thanks in advance for any help.

This is the script we're using:

if objFSO.FolderExists(strPhysicalPath) Then
dim x, xx, i, j, tempx
x = 0
For Each objFileItem In objFolderContents
x = x + 1
Next

tempx = x - 1

Dim temps( )
dim tempsd( )
redim temps(x)
redim tempsd(x)
xx = 0
For Each objFileItem In objFolderContents
temps(xx)=objFileItem.Name
tempsd(xx)=objFileItem.DateLastModified
xx = xx + 1
Next

if (sortbydate) then ''sorts folder contents by date
for i = tempx To 0 Step -1
for j = 0 to tempx
if tempsd(j) > tempsd(j+1) then
temp=temps(j+1)
temp2=tempsd(j+1)

temps(j+1)=temps(j)
tempsd(j+1)=tempsd(j)

temps(j)=temp
tempsd(j)=temp2
end if
next
next
x = 1
else
x = 0
end if

if (sortbydate) then
tempx = tempx + 1
for x = tempx To 1 Step -1

select case Ucase(right(temps(x),3))
case "PDF"
strImageType = "pdf.gif"
case "DOC"
strImageType = "doc.gif"
case "HTM"
strImageType = "IEXPLORE1.gif"
case "TML"
strImageType = "IEXPLORE1.gif"
case "XLS"
strImageType = "xls.gif"
case else
strImageType = "document.gif"
end select

if date < tempsd(x)+ strDays then
strNewFile="<font size=""1"" color=""red"" face=""arial"">updated" & strNewFile &"</b><br></font>"
else
strNewFile=""
end if
strLen = Len(temps(x))
if instr(temps(x),"~")=0 then
Response.Write "<img src=""images/doc_images/"& strImageType &""" border=""0"" align=""texttop"" vspace=""1""> <a href=""#"" Onclick=""javascript:Start_large('File:"&strPhysicalPath & Replace(replace(temps(x),"'","\'")," ", "%20")&"')""; class=""intranet"" onmouseover=""window.status=('" & strFolder & ": " & left(replace(Replace(temps(x),"_", " "),"'","\'"),strLen - 4) & "'); return true;"" onmouseout=""window.status=(' '); return true;"">" & left(Replace(temps(x),"_", " "),strLen - 4) & "</a>" & strNewFile&"<br>" & chr(13) & chr(10)
end if



Next
else
for x = 0 To tempx

select case Ucase(right(temps(x),3))
case "PDF"
strImageType = "pdf.gif"
case "DOC"
strImageType = "doc.gif"
case "HTM"
strImageType = "IEXPLORE1.gif"
case "TML"
strImageType = "IEXPLORE1.gif"
case "XLS"
strImageType = "xls.gif"
case else
strImageType = "document.gif"
end select



if date < tempsd(x)+ strDays then
strNewFile= "updated " & FormatDateTime(date,1)

else
strNewFile=""
end if
strLen = Len(temps(x))
if instr(temps(x),"~")=0 then
Response.Write "<img src=""images/doc_images/"& strImageType &""" border=""0"" align=""texttop"" vspace=""1""> <a href=""#"" Onclick=""javascript:Start_large('File:"&strPhysicalPath & Replace(replace(temps(x),"'","\'")," ", "%20")&"')""; class=""intranet"" onmouseover=""window.status=('" & strFolder & ": " & left(replace(Replace(temps(x),"_", " "),"'","\'"),strLen - 4) & "'); return true;"" onmouseout=""window.status=(' '); return true;"">" & left(Replace(temps(x),"_", " "),strLen - 4) & "</a><b><font size=""1"" color=""red"" face=""arial""> &nbsp;" & strNewFile &"</b><br></font>" & chr(13) & chr(10)
end if
Next
end if

Set objFile = Nothing
Set objFolder = Nothing
Set objFolderContents = Nothing
end if
Set objFSO = Nothing
 
I'd say load up sharepoint and use the local search features in that!

If you are already enumerating the files in a folder, why not make them hyperlinks and have the user use CTRL+F to search for the file name or part of the file name.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
I will research them both.
Thank you to you both. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top