FSO Woes(kinda long post)

Ask a Question related to ASP, Design and Development.

  1. #1

    Default FSO Woes(kinda long post)

    Lets see if I can explain this so I can get a good answer =)

    I'm trying to speed up a file search via FSO. I have a database that
    contains the exact path where files can be found and an "index" number
    assigned to each file. This index number is part of each files name.
    Example:
    DB columns
    filepath flindex
    pathname 123
    pathname 124
    pathname 125
    etc etc

    Now the file structure is:
    pathname\123 file.txt
    pathname\124 file.txt
    pathname\125 file.txt

    Now if the actual file names were just a single extension I wouldn't have
    any problems because then I could just call up each file, my problem is that
    this "index" number is kinda like a place holder for any file type.
    pathname\123 file.txt
    pathname\123 file.pdf
    pathname\123 file.doc

    In my current code I end up using this:
    For Each fl in fc
    fileIndex = Left(fl.name,InStr(fl.name," "))
    if fileIndex = flindex & " " Then
    Response.write ("|<a href ='" & webpath & fl.name & "' >" & fl.name &
    "</a>|")
    End if
    Next

    The above code works great, gives me the links I'm looking for based on each
    "indexed" file. My only serious issue is that depending on the exact path I
    might loop through only 10 files, or I might loop through 1000's of files.
    It is these paths with 1000's of files where my heartache comes from. It
    might take up to a minute for the code to loop through a given folder to
    match the indexed files I'm looking for.

    I'm sorry for making this post so long, but I thought it might give everyone
    a better idea of what I'm trying to accomplish if given more background.

    So.... what I'm wanting to ask, is there anyway to possibly speed up my
    files searches? Or am I just stuck looping until I find my matches?


    David P. Jessup Guest

  2. Similar Questions and Discussions

    1. [PHP] Date Validation, Kinda'
      Now that I'm thinking about it, what is your goal with this? Is it to make sure the date entered is within a certain range when compared to another...
    2. kinda OT--CDO importance
      I've been using CDO to send an email with an Intranet app I have. Can't for the life of me remember where I got this code: .Importance = 1 '...
    3. what kinda mouse?
      I have the ms track ball explorer 1. The ball is dragging to bad to use so I'm in the market for a new mouse...I went to the roller ball mouse cause...
    4. kinda OT video ?
      Can a .inf file be made to run a avi or mpeg on insertion of CD? I want to put video file onto cd and have it auto start when it is inserted into...
    5. Better way to delete - kinda long
      Currently when I create add/edit/delete options for webpages I use the following format: 3 web pages: add - This is a regular form where you...
  3. #2

    Default Re: FSO Woes(kinda long post)

    > So.... what I'm wanting to ask, is there anyway to possibly speed up my
    > files searches? Or am I just stuck looping until I find my matches?
    Well, you could use index server.

    Or, you could have a background task (e.g. VBS, or even a SQL Server job)
    that runs every five minutes (or whatever threshold is acceptable) and
    updates a database table with the information about the file system. Then
    the ASP code (which is the only part a user has to actively wait for) would
    only be responsible for returning a list from the database, and wouldn't
    have to even know that a filesystem exists...

    A


    Aaron Bertrand - MVP Guest

  4. #3

    Default Re: FSO Woes(kinda long post)

    I'm glad you have an idea. I'm trying to think of a way to use:

    cmd.exe /c dir /B C:\path\123*.*

    I guess you could use that in conjunction with a StdOut. Maybe:
    <%
    Dim oShell, oExec
    Dim sPath, sIndex, sCommand, sOutput
    sPath = "C:\pathname\"
    sIndex = "123"
    sCommand = "cmd.exe /c dir /B " & sPath & sIndex & "*.*"

    Set oShell = Server.CreateObject("WScript.Shell")
    Set oExec = oShell.Exec(sCommand)
    Do While Not oExec.StdOut.AtEndOfStream
    sOutput = sOutput & oExec.StdOut.Read(1)
    Loop
    Set oExec = Nothing
    Set oShell = NOthing

    If Len(Trim(sOutput)) > 0 Then
    aFiles = Split(sOutput, vbCrLf)
    For i = 0 To UBound(aFiles)
    Response.Write "|<a href ='" & webpath & aFiles(i) & "' >" &
    aFiles(i) & "</a>|"
    Next
    Else
    Response.Write "0 files"
    End If
    %>

    Ray at work


    "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
    news:%23grY7ApkDHA.2200@TK2MSFTNGP12.phx.gbl...
    > > So.... what I'm wanting to ask, is there anyway to possibly speed up my
    > > files searches? Or am I just stuck looping until I find my matches?
    >
    > Well, you could use index server.
    >
    > Or, you could have a background task (e.g. VBS, or even a SQL Server job)
    > that runs every five minutes (or whatever threshold is acceptable) and
    > updates a database table with the information about the file system. Then
    > the ASP code (which is the only part a user has to actively wait for)
    would
    > only be responsible for returning a list from the database, and wouldn't
    > have to even know that a filesystem exists...
    >
    > A
    >
    >

    Ray at Guest

  5. #4

    Default Re: FSO Woes(kinda long post)

    Heh,

    Well I was trying to make my post as short as possible, but I guess I need
    to expand it a bit more. I'm writing a web interface to a desktop app.
    This application supports either Access DB's or any other Relational DB.
    The only requirement for the end users would be having IIS running on some
    machine. I can't be certain they would be running Index Server. I'm trying
    to encapsulate everything into a few ASP pages. Like I said I have a good
    working set of ASP files now, but now I'm going back trying to optimize my
    code and streamline stuff(like I changed my old code that looped through
    recordsets to now use getrows[that was a nice improvement itself]).

    Thanks for the suggestion Aaron, I'll just keep pluggin' away with what I
    have, maybe someone will actually have a savvy way to help me.
    --
    Thanks from this ASP Newbie

    --
    Thanks from this ASP Newbie
    "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
    news:%23grY7ApkDHA.2200@TK2MSFTNGP12.phx.gbl...
    > > So.... what I'm wanting to ask, is there anyway to possibly speed up my
    > > files searches? Or am I just stuck looping until I find my matches?
    >
    > Well, you could use index server.
    >
    > Or, you could have a background task (e.g. VBS, or even a SQL Server job)
    > that runs every five minutes (or whatever threshold is acceptable) and
    > updates a database table with the information about the file system. Then
    > the ASP code (which is the only part a user has to actively wait for)
    would
    > only be responsible for returning a list from the database, and wouldn't
    > have to even know that a filesystem exists...
    >
    > A
    >
    >

    David P. Jessup Guest

  6. #5

    Default Re: FSO Woes(kinda long post)


    "David P. Jessup" <davidATimntDASHtechDOTcom> wrote in message
    news:eTFV4IpkDHA.424@TK2MSFTNGP10.phx.gbl...
    >
    > Thanks for the suggestion Aaron, I'll just keep pluggin' away with what I
    > have, maybe someone will actually have a savvy way to help me.
    So in other words, Aaron never has savvy solutions? :P

    Ray at work


    Ray at Guest

  7. #6

    Default Re: FSO Woes(kinda long post)

    Ray,

    That would work, but not across a UNC path right? Thanks for reading my
    post, like I said, maybe someone will come up with a bright idea that I'm
    currently lacking =)

    --
    Thanks from this ASP Newbie
    "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:%23KxsWGpkDHA.3700@TK2MSFTNGP11.phx.gbl...
    > I'm glad you have an idea. I'm trying to think of a way to use:
    >
    > cmd.exe /c dir /B C:\path\123*.*
    >
    > I guess you could use that in conjunction with a StdOut. Maybe:
    > <%
    > Dim oShell, oExec
    > Dim sPath, sIndex, sCommand, sOutput
    > sPath = "C:\pathname\"
    > sIndex = "123"
    > sCommand = "cmd.exe /c dir /B " & sPath & sIndex & "*.*"
    >
    > Set oShell = Server.CreateObject("WScript.Shell")
    > Set oExec = oShell.Exec(sCommand)
    > Do While Not oExec.StdOut.AtEndOfStream
    > sOutput = sOutput & oExec.StdOut.Read(1)
    > Loop
    > Set oExec = Nothing
    > Set oShell = NOthing
    >
    > If Len(Trim(sOutput)) > 0 Then
    > aFiles = Split(sOutput, vbCrLf)
    > For i = 0 To UBound(aFiles)
    > Response.Write "|<a href ='" & webpath & aFiles(i) & "' >" &
    > aFiles(i) & "</a>|"
    > Next
    > Else
    > Response.Write "0 files"
    > End If
    > %>
    >
    > Ray at work
    >
    >
    > "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
    > news:%23grY7ApkDHA.2200@TK2MSFTNGP12.phx.gbl...
    > > > So.... what I'm wanting to ask, is there anyway to possibly speed up
    my
    > > > files searches? Or am I just stuck looping until I find my matches?
    > >
    > > Well, you could use index server.
    > >
    > > Or, you could have a background task (e.g. VBS, or even a SQL Server
    job)
    > > that runs every five minutes (or whatever threshold is acceptable) and
    > > updates a database table with the information about the file system.
    Then
    > > the ASP code (which is the only part a user has to actively wait for)
    > would
    > > only be responsible for returning a list from the database, and wouldn't
    > > have to even know that a filesystem exists...
    > >
    > > A
    > >
    > >
    >
    >

    David P. Jessup Guest

  8. #7

    Default Re: FSO Woes(kinda long post)

    ROFL,

    Should I change my subject to:
    "drop down population help needed - thanks"? =)

    --
    Thanks from this ASP Newbie
    "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:eH%23nvKpkDHA.2060@tk2msftngp13.phx.gbl...
    >
    > "David P. Jessup" <davidATimntDASHtechDOTcom> wrote in message
    > news:eTFV4IpkDHA.424@TK2MSFTNGP10.phx.gbl...
    >
    > >
    > > Thanks for the suggestion Aaron, I'll just keep pluggin' away with what
    I
    > > have, maybe someone will actually have a savvy way to help me.
    >
    > So in other words, Aaron never has savvy solutions? :P
    >
    > Ray at work
    >
    >

    David P. Jessup Guest

  9. #8

    Default Re: FSO Woes(kinda long post)

    You can dir a UNC path, but you're going to have permissions issues,
    undoubtedly.

    Oh, I forgot. You'd probably want the command to be:
    sCommand = "cmd.exe /c dir /A-d /B " & sPath & sIndex & "*.*"

    The /a-d will skip directoies that happen to match the search.

    Ray at work


    "David P. Jessup" <davidATimntDASHtechDOTcom> wrote in message
    news:eC9LhNpkDHA.2080@TK2MSFTNGP10.phx.gbl...
    > Ray,
    >
    > That would work, but not across a UNC path right? Thanks for reading my
    > post, like I said, maybe someone will come up with a bright idea that I'm
    > currently lacking =)
    >
    > --
    > Thanks from this ASP Newbie

    Ray at Guest

  10. #9

    Default Re: FSO Woes(kinda long post)

    Ray,

    Just wanted to thank you, I believe this might work. After tweaking it a
    bit I have gotten good results. Below is the changes I made:

    If Len(Trim(sOutput)) > 0 Then
    aFiles = Split(sOutput, vbCrLf)
    For i = 0 To UBound(aFiles)
    fileIndex = int(Left(aFiles(i),InStr(aFiles(i)," "))) 'added to single
    out just the index number
    if fileIndex = sIndex Then 'fire off URL when file matches index
    Response.Write "|<a href ='" & webpath & aFiles(i) & "' >" &
    aFiles(i) & "</a>|"
    end if
    Next
    Else
    Response.Write "Sorry, there are no matching files for this query.<br>"
    End If

    I had to add a bit of code, otherwise say if I just was searching for an
    index of "3" I would get 3, 33, 303, etc.
    Now to do further testing and see where I will run into permission issues.
    --
    Thanks from this ASP Newbie

    "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:%23KxsWGpkDHA.3700@TK2MSFTNGP11.phx.gbl...
    > If Len(Trim(sOutput)) > 0 Then
    > aFiles = Split(sOutput, vbCrLf)
    > For i = 0 To UBound(aFiles)
    > Response.Write "|<a href ='" & webpath & aFiles(i) & "' >" &
    > aFiles(i) & "</a>|"
    > Next
    > Else
    > Response.Write "0 files"
    > End If

    David P. Jessup Guest

  11. #10

    Default Re: FSO Woes(kinda long post)

    Oh, NOW I get it... :]

    "David P. Jessup" <davidATimntDASHtechDOTcom> wrote in message
    news:uLV4qOpkDHA.2676@TK2MSFTNGP11.phx.gbl...
    >
    > Should I change my subject to:
    > "drop down population help needed - thanks"? =)

    Ray at Guest

  12. #11

    Default Re: FSO Woes(kinda long post)

    Nice! For the permissions issue when accessing shares, this article is
    applicable. [url]http://www.aspfaq.com/show.asp?id=2168[/url] See the part about "If
    the file is on your LAN." This isn't what you're trying to do, but the
    synching of the IUSR accounts part is what you'll probably need to do.

    Ray at work



    "David P. Jessup" <davidATimntDASHtechDOTcom> wrote in message
    news:%23pDxmypkDHA.1656@tk2msftngp13.phx.gbl...
    > Ray,
    >
    > Just wanted to thank you, I believe this might work. After tweaking it a
    > bit I have gotten good results. Below is the changes I made:
    >
    > If Len(Trim(sOutput)) > 0 Then
    > aFiles = Split(sOutput, vbCrLf)
    > For i = 0 To UBound(aFiles)
    > fileIndex = int(Left(aFiles(i),InStr(aFiles(i)," "))) 'added to single
    > out just the index number
    > if fileIndex = sIndex Then 'fire off URL when file matches index
    > Response.Write "|<a href ='" & webpath & aFiles(i) & "' >" &
    > aFiles(i) & "</a>|"
    > end if
    > Next
    > Else
    > Response.Write "Sorry, there are no matching files for this
    query.<br>"
    > End If
    >
    > I had to add a bit of code, otherwise say if I just was searching for an
    > index of "3" I would get 3, 33, 303, etc.
    > Now to do further testing and see where I will run into permission issues.
    > --
    > Thanks from this ASP Newbie
    >
    > "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    > news:%23KxsWGpkDHA.3700@TK2MSFTNGP11.phx.gbl...
    > > If Len(Trim(sOutput)) > 0 Then
    > > aFiles = Split(sOutput, vbCrLf)
    > > For i = 0 To UBound(aFiles)
    > > Response.Write "|<a href ='" & webpath & aFiles(i) & "' >" &
    > > aFiles(i) & "</a>|"
    > > Next
    > > Else
    > > Response.Write "0 files"
    > > End If
    >
    >

    Ray at Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139