crystalnewbie
MIS
I'm trying to find specific files based on costcenter and date embedded in the filename of a text file.
The files are not in the webserver and contains over 7000 files totalling 400+mb (each file is around 10Kb).
Don't have any problems with the files. Problem is, it is taking too long to find them (1 1/2 minutes).
Is there any way to speed this up?
TIA-
dim prDate, prThtr
prDate = CDate(Request("strSDate"))
prThtr = Request("strThr")
findsls = instr(prThtr,";")
prThtr = mid(prThtr,findsls+1)
'Create the File Object to retrieve the Files.
Set fso = CreateObject("Scripting.FileSystemObject")
Set foldr = fso.GetFolder(sPP)
Set allfile = foldr.Files
dim site
site = mid(request("strThr"),1,6)
dim costcenter, filedate
dim dateArray(7,2)
dim x
For x = 0 to 6
dateArray(x,1) = dateadd("d", -1 * x, prDate)
Next 'x
For Each objItem In foldr.Files
costcenter = mid(objItem.Name,1,6)
filedate = mid(objItem.Name,8,2) & "/" & mid(objItem.Name,10,2) & "/" & mid(objItem.Name,12,4)
if costcenter = site then
for y = 0 to 6
if cdate(filedate) = dateArray(y,1) then
dateArray(y,2) = "Transmitted"
end if
next 'y
%>
<%
end if
Next 'objItem
for z = 0 to 6
response.write "<tr bgcolor = 'lightgrey'>" & vbCrLF
response.write "<td> " & weekdayname(weekday(dateArray(z,1))) & ", " & dateArray(z,1) & "</td>"
response.write "<td> " & dateArray(z,2) & "</td></tr>"
next 'z
%>
<%
'Set allff = nothing
Set fso = nothing
Set foldr = nothing
Set allfile = nothing
%>
The files are not in the webserver and contains over 7000 files totalling 400+mb (each file is around 10Kb).
Don't have any problems with the files. Problem is, it is taking too long to find them (1 1/2 minutes).
Is there any way to speed this up?
TIA-
dim prDate, prThtr
prDate = CDate(Request("strSDate"))
prThtr = Request("strThr")
findsls = instr(prThtr,";")
prThtr = mid(prThtr,findsls+1)
'Create the File Object to retrieve the Files.
Set fso = CreateObject("Scripting.FileSystemObject")
Set foldr = fso.GetFolder(sPP)
Set allfile = foldr.Files
dim site
site = mid(request("strThr"),1,6)
dim costcenter, filedate
dim dateArray(7,2)
dim x
For x = 0 to 6
dateArray(x,1) = dateadd("d", -1 * x, prDate)
Next 'x
For Each objItem In foldr.Files
costcenter = mid(objItem.Name,1,6)
filedate = mid(objItem.Name,8,2) & "/" & mid(objItem.Name,10,2) & "/" & mid(objItem.Name,12,4)
if costcenter = site then
for y = 0 to 6
if cdate(filedate) = dateArray(y,1) then
dateArray(y,2) = "Transmitted"
end if
next 'y
%>
<%
end if
Next 'objItem
for z = 0 to 6
response.write "<tr bgcolor = 'lightgrey'>" & vbCrLF
response.write "<td> " & weekdayname(weekday(dateArray(z,1))) & ", " & dateArray(z,1) & "</td>"
response.write "<td> " & dateArray(z,2) & "</td></tr>"
next 'z
%>
<%
'Set allff = nothing
Set fso = nothing
Set foldr = nothing
Set allfile = nothing
%>