search the entire directory structure

Results 1 to 3 of 3

Thread: search the entire directory structure

  1. #1
    Join Date
    Dec 1969

    Default search the entire directory structure

    Curently this is the code that i came up with.. but it can only search up to one level deep into a directory... I want to search through the entire directory structure.. <BR><BR> &#039;--loop through all the subfolders<BR> for each objSubFolder in objFolder.subFolders<BR> &#039;--avoid looking in _vti_cnf folders<BR> if not = "_vti_cnf" then<BR> response.Write("@ &#060;b&#062;" & & "&#060;/b&#062;<BR>") &#039;debug<BR> <BR> for each objFile in objSubFolder.files<BR> strFileName =<BR> response.Write("&nbsp;&nbsp;&#124&nbsp;- " & strFileName & "<BR>") &#039;debug<BR> <BR> set objTextStream = objFSO.OpenTextFile(objFile.path,fsoForReading)<BR > strFileContents = objTextStream.readAll<BR> if inStr(1,strFileContents,strSearchText,1) or inStr(1, strFileName, strSearchText,1) then<BR> tmpSearchOut = tmpSearchOut & "&#060;LI&#062;&#060;A HREF=""" & strSearchDir & & "/" & strFileName & _<BR> """ target=""_blank""&#062;" & strFileName & "&#060;/A&#062;<BR>"<BR> bolFileFound = true<BR> end if<BR> next<BR> end if<BR> next

  2. #2
    Join Date
    Dec 1969

    Default RE: RTFFAQs [eom].


  3. #3
    Join Date
    Dec 1969

    Default Recursion

    That code takes a folder - objFolder - to start.<BR><BR>Turn it into a function that takes objFolder as a PARAMETER.<BR><BR>Then, as you iterate through objFolder.SubFolders, you can simply call the function and pass each subfolder as an argument in turn.<BR><BR>This is called Recursion (the function recursively calls itself).<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts