search for specific filename from folder

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    search for specific filename from folder

    Hi

    i've got folder with lots of images on it,
    what i would like to do is trying to seach the specific image filename
    using ( FileSystemObjec t ) & textbox

    i've got this code that can search the files in folder bringing full list of file.

    Code:
        set FileSysObj=CreateObject("Scripting.FileSystemObject")
        strFileAndPath = request.servervariables("SCRIPT_NAME")
        strPathOnly = Mid(strFileAndPath,1 ,InStrRev(strFileAndPath, "/"))
        strFullPath = server.mappath(strPathOnly)
        set fldr=FileSysObj.GetFolder(strFullPath)
    
        set FileList = fldr.Files
        For Each FileIndex in FileList
            'This bit excludes this page (and other asp files) from the list of links
            if Lcase(right(FileIndex.Name, 4)) <> ".ini" then
                Response.Write("<A HREF='" & FileIndex.name & "'>" & FileIndex.name & "</A><BR>")
            end if
        Next
    IS ANY BODY KNW HOW TO GET CRACK ON TO ACHIVE THIS RESULT ?
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    #2
    any body kw\ssssssssssss sssssssssssssss ssssssssss
    Thxs in advance

    Comment

    • GazMathias
      Recognized Expert New Member
      • Oct 2008
      • 228

      #3
      This bit:

      Code:
       Response.Write("<A HREF='" & FileIndex.name & "'>" & FileIndex.name & "</A><BR>")
      Becomes:

      Code:
      If instr(FileIndex.name,"[YOUR TEXT HERE]") >0 Then
      Response.Write("<A HREF='" & FileIndex.name & "'>" & FileIndex.name & "</A><BR>")
      End if
      Obviously you need to feed the [YOUR TEXT HERE] bit with something.

      Gaz

      Comment

      Working...