Ask a Question related to ASP, Design and Development.
-
David P. Jessup #1
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
-
[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... -
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 '... -
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... -
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... -
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... -
Aaron Bertrand - MVP #2
Re: FSO Woes(kinda long post)
> So.... what I'm wanting to ask, is there anyway to possibly speed up my
Well, you could use index server.> files searches? Or am I just stuck looping until I find my matches?
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
-
Ray at #3
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...would>> > 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)> 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
-
David P. Jessup #4
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...would>> > 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)> 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
-
Ray at #5
Re: FSO Woes(kinda long post)
"David P. Jessup" <davidATimntDASHtechDOTcom> wrote in message
news:eTFV4IpkDHA.424@TK2MSFTNGP10.phx.gbl...
So in other words, Aaron never has savvy solutions? :P>
> 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.
Ray at work
Ray at Guest
-
David P. Jessup #6
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...my> 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 upjob)> >> > > 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 ServerThen> > that runs every five minutes (or whatever threshold is acceptable) and
> > updates a database table with the information about the file system.> would> > the ASP code (which is the only part a user has to actively wait for)>> > 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
-
David P. Jessup #7
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...I>
> "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>> > 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
-
Ray at #8
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
-
David P. Jessup #9
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
-
Ray at #10
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
-
Ray at #11
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...query.<br>"> 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> 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



Reply With Quote

