FSO问题(有点长) [英] FSO Woes(kinda long post)

查看:67
本文介绍了FSO问题(有点长)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们看看能不能解释一下这样我就能得到一个好的答案=)


我正在尝试通过FSO加速文件搜索。我有一个数据库,

包含可以找到文件的确切路径和索引。数字

分配给每个文件。这个索引号是每个文件名的一部分。

例如:

DB列

filepath flindex

pathname 123

路径名124

路径名125

等等


现在文件结构为:

pathname\123 file.txt

pathname\124 file.txt

pathname \\\125 file.txt

现在如果实际文件名只是一个扩展名我就不会有任何问题因为那时我只能调用每个文件,我的问题是

这个索引 number有点像任何文件类型的占位符。

pathname \123 file.txt

pathname \123 file.pdf

pathname \ .123 file.doc

在我目前的代码中,我最终使用了这个:

For f fl in fc

fileIndex = Left(fl.name,InStr(fl.name,""))

if fileIndex = flindex& " "然后

Response.write(" |< a href =''"& webpath& fl.name&"''>"& fl.name&

"< / a> |")

结束如果

下一页


以上代码效果很好,根据每个

" indexed"给出了我正在寻找的链接。文件。我唯一严重的问题是,根据确切的路径,我只需要循环浏览10个文件,或者我可能会遍历1000个文件。

这些是1000个文件的路径,我的心痛来自哪里。它可能需要花费一分钟才能使代码循环到给定的文件夹,以便

匹配我正在寻找的索引文件。


我很抱歉这篇文章很长,但我认为如果给予更多背景,我可能会更好地了解我想要完成的事情。


所以......我想问的是,无论如何可能加速我的

文件搜索?或者我只是卡住循环直到找到匹配项?

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?

推荐答案

>那么......我想问的是,无论如何可能加速我的
> 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?




好​​吧,你可以使用索引服务器。


或者,你可以有一个后台任务(例如VBS,甚至一个SQL Server工作)

每五分钟运行一次(或任何可接受的阈值)和

更新数据库表有关文件系统的信息。然后

ASP代码(这是用户必须主动等待的唯一部分)

只负责从数据库返回一个列表,并且不会t $ / b $ b甚至必须知道存在一个文件系统...


A



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


我'很高兴你有个主意。我正在考虑一种使用方法:


cmd.exe / c dir /BC:\path\123*.*

我猜你可以和StdOut一起使用它。也许:

<%

Dim oShell,oExec

Dim sPath,sIndex,sCommand,sOutput

sPath =" C:\ pathname \"

sIndex =" 123"

sCommand =" cmd.exe / c dir / B" &安培; sPath& sIndex& " *。*"


设置oShell = Server.CreateObject(" WScript.Shell")

设置oExec = oShell.Exec(sCommand)

Do While Not OExec.StdOut.AtEndOfStream

sOutput = sOutput& oExec.StdOut.Read(1)

循环

设置oExec = Nothing

设置oShell = NOthing


如果Len(Trim(sOutput))> 0然后

aFiles = Split(sOutput,vbCrLf)

For i = 0 To UBound(aFiles)

Response.Write" |< lt ; a href =''" &安培; webpath& aFiles(i)& "''>" &

aFiles(i)& "< / a> |"

下一页

否则

Response.Write" 0 files"

结束如果

%>


Ray在工作中

Aaron Bertrand - MVP" < AA *** @ TRASHaspfaq.com>在消息中写道

news:%2 **************** @ TK2MSFTNGP12.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...
那么......我想问的是,无论如何可能加快我的
文件搜索速度?或者我只是卡住循环直到找到我的匹配?
好吧,你可以使用索引服务器。

或者,你可以有一个后台任务(例如VBS,甚至是SQL Server工作)每隔五分钟运行一次(或任何可接受的阈值),并使用有关文件系统的信息更新数据库表。然后是ASP代码(这是用户必须主动等待的唯一部分)
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)



只负责从数据库返回一个列表,并且不会 t
甚至必须知道文件系统存在...


would only be responsible for returning a list from the database, and wouldn''t
have to even know that a filesystem exists...

A



嘿,


好​​吧,我试图让我的帖子尽可能短,但我想我需要

来扩展它。我正在为桌面应用程序编写一个Web界面。

此应用程序支持Access DB或任何其他Relational DB。

结束的唯一要求用户将在一些

机器上运行IIS。我不能肯定他们会运行Index Server。我正在尝试将
封装到几个ASP页面中。就像我说的那样,现在我有一个很好的

工作组的ASP文件,但现在我要回去试图优化我的

代码并简化一些东西(比如我改了)我的旧代码循环通过

记录集现在使用getrows [这本身就是一个很好的改进]。


感谢Aaron的建议,我''只是保持插件''我没有b $ b,也许有人会有一个精明的方式来帮助我。

-

感谢这个ASP新手


-

感谢这个ASP新手

" Aaron Bertrand - MVP" < AA *** @ TRASHaspfaq.com>在消息中写道

news:%2 **************** @ TK2MSFTNGP12.phx.gbl ...
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...
那么......我想问的是,无论如何可能加快我的
文件搜索速度?或者我只是卡住循环直到找到我的匹配?
好吧,你可以使用索引服务器。

或者,你可以有一个后台任务(例如VBS,甚至是SQL Server工作)每隔五分钟运行一次(或任何可接受的阈值),并使用有关文件系统的信息更新数据库表。然后是ASP代码(这是用户必须主动等待的唯一部分)
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)



只负责从数据库返回一个列表,并且不会 t
甚至必须知道文件系统存在...


would only be responsible for returning a list from the database, and wouldn''t
have to even know that a filesystem exists...

A



这篇关于FSO问题(有点长)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆