Connecting Tech Pros Worldwide Help | Site Map

search for specific filename from folder

  #1  
Old May 12th, 2009, 03:48 PM
Familiar Sight
 
Join Date: Jul 2007
Location: United Kingdom
Posts: 202
Provided Answers: 1
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 ( FileSystemObject ) & textbox

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

Expand|Select|Wrap|Line Numbers
  1.     set FileSysObj=CreateObject("Scripting.FileSystemObject")
  2.     strFileAndPath = request.servervariables("SCRIPT_NAME")
  3.     strPathOnly = Mid(strFileAndPath,1 ,InStrRev(strFileAndPath, "/"))
  4.     strFullPath = server.mappath(strPathOnly)
  5.     set fldr=FileSysObj.GetFolder(strFullPath)
  6.  
  7.     set FileList = fldr.Files
  8.     For Each FileIndex in FileList
  9.         'This bit excludes this page (and other asp files) from the list of links
  10.         if Lcase(right(FileIndex.Name, 4)) <> ".ini" then
  11.             Response.Write("<A HREF='" & FileIndex.name & "'>" & FileIndex.name & "</A><BR>")
  12.         end if
  13.     Next
  14.  
IS ANY BODY KNW HOW TO GET CRACK ON TO ACHIVE THIS RESULT ?
  #2  
Old May 13th, 2009, 07:08 PM
Familiar Sight
 
Join Date: Jul 2007
Location: United Kingdom
Posts: 202
Provided Answers: 1

re: search for specific filename from folder


any body kw\sssssssssssssssssssssssssssssssssssss
Thxs in advance
  #3  
Old May 14th, 2009, 01:47 PM
GazMathias's Avatar
Expert
 
Join Date: Oct 2008
Location: Bristol, United Kingdom
Posts: 138

re: search for specific filename from folder


This bit:

Expand|Select|Wrap|Line Numbers
  1.  Response.Write("<A HREF='" & FileIndex.name & "'>" & FileIndex.name & "</A><BR>")
  2.  
Becomes:

Expand|Select|Wrap|Line Numbers
  1. If instr(FileIndex.name,"[YOUR TEXT HERE]") >0 Then
  2. Response.Write("<A HREF='" & FileIndex.name & "'>" & FileIndex.name & "</A><BR>")
  3. End if
Obviously you need to feed the [YOUR TEXT HERE] bit with something.

Gaz
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: extract from zip files.. crashonyou answers 11 October 27th, 2007 02:02 PM
Database structure decision Mikee Freedom answers 14 February 2nd, 2007 06:05 PM
.Net frameword Resources ( vb.net , asp.net etc...) shamirza answers 0 January 17th, 2007 08:05 AM
How to get filename using C language Hughes answers 10 November 13th, 2005 10:49 PM