473,394 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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?
Jul 19 '05 #1
10 2773
> 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
Jul 19 '05 #2
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" <aa***@TRASHaspfaq.com> wrote in message
news:%2****************@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

Jul 19 '05 #3
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" <aa***@TRASHaspfaq.com> wrote in message
news:%2****************@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

Jul 19 '05 #4

"David P. Jessup" <davidATimntDASHtechDOTcom> wrote in message
news:eT*************@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
Jul 19 '05 #5
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:%2****************@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" <aa***@TRASHaspfaq.com> wrote in message
news:%2****************@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


Jul 19 '05 #6
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****************@tk2msftngp13.phx.gbl...

"David P. Jessup" <davidATimntDASHtechDOTcom> wrote in message
news:eT*************@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

Jul 19 '05 #7
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:eC**************@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

Jul 19 '05 #8
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:%2****************@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

Jul 19 '05 #9
Oh, NOW I get it... :]

"David P. Jessup" <davidATimntDASHtechDOTcom> wrote in message
news:uL**************@TK2MSFTNGP11.phx.gbl...

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

Jul 19 '05 #10
Nice! For the permissions issue when accessing shares, this article is
applicable. http://www.aspfaq.com/show.asp?id=2168 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:%2****************@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:%2****************@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


Jul 19 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Arun Bhalla | last post by:
I'm having some inconsistency problems with my deployment project ("Setup") and its custom actions ("Installer"). I'm using Visual Studio .NET 2003 (.NET 1.1, no service pack) on Windows XPSP1. ...
21
by: Asfand Yar Qazi | last post by:
Hi, After much use of tabs worth 8 spaces, and constantly having to format my C++ code in funny ways to keep all lines within an 80 character line length limit, I'm seriously thinking of...
0
by: Dmitriy Lapshin [C# / .NET MVP] | last post by:
Hello all, This is a long post but I'd better provide all the details from the outset to prevent cluttering the NGs with clarifications. I also apologize for cross-posting, I am just not sure...
9
by: Mark Rae | last post by:
Hi, This time, I'm looking for a regular expression which says "the string must contain exactly seven or exactly eight digits" e.g. 123456 fails 1234567 passes 12345678 passes 123456789...
1
by: Red | last post by:
Hi All, My first proper go at a web site, so be gentle. I have a couple of pages that look good in FF, but not in IE. Any advice would be greatly appreaciated! Navigation menu: OK in FF...
4
by: =?Utf-8?B?VkIgSm9ubmll?= | last post by:
I am at my witless end here, please help! I have an ASP.Net aspx web page, hosted on Windows Server 2003, that receives a query string with the path to an autocad drawing file selected from a...
0
by: foahchon | last post by:
Hi, I'm trying to write a receive loop in my socket class that will receive what data is in the buffer, call an event to let the user know that there's new data, and then receive the rest of the...
0
by: Microsoft Newsserver | last post by:
OK guys I know this isnt a javascrip forum, but I am building a .net application on the web so, it kinda lets me ask the question at least :) I have the following constructs *************...
9
xpun
by: xpun | last post by:
hey all So I decided to be a little ambitious over the summer and create the game of clue in c. I figured it would give my self a GOOD refresher of the language and further understand functions...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.