哪位好心的大哥帮看看 这段FSO代码啊? 小第先谢过拉
<%
dim fso, f, lastmd(), path(), num 'lastmd用于存放最近修改的5个文件名
num = 0
set fso = server.createobject("scripting.filesystemobject")
set f= fso.getfolder(server.MapPath("/Pictures"))
if fso.FolderExists(pt) then '判断路径是否存在
for each temp in f.files '将对象放如数组lastmd()中
redim Preserve lastmd(num)
redim Preserve path(num)
lastmd(num) =temp.Datecreated '获得文件创建时间
path(num) = temp.path '获得文件的路径
num = num + 1
next
else response.write "文件夹不存在!"
end if
set fso = nothing '销毁
set f = nothing
sub compare(s1,s2) '比较时间 由大到小 s1为文件创建时间的数组,s2为文件路径
dim j,i,x,y
For i=0 to UBound(s1)
For j=0 to UBound(s1)-1
if Cint(Cdate(s1(i)) - Cdate(s1(j))) > 0 then
x = s1(i)
s1(i) = s1(j)
s1(j) = x
y = s2(i)
s2(i) = s2(j)
s2(j) = y
end if
next
next
end sub
function gettime(i)
call compare(lastmd,path)
response.Write lastmd(i) + "<br>" + path(i)+ "<br><br>"
end function
%>
<%
dim i
for i=0 to 4
gettime(i)
next
%>
错误是 :文件夹不存在!
Microsoft VBScript 运行时错误 错误 '800a0009'
下标越界: 'UBound'
/testserch.asp,行23
就是那 For i=0 to UBound(s1)
问题点数:20、回复次数:2Top
1 楼mazefeng81(冷酷到底81)回复于 2006-06-02 20:32:38 得分 20
建立那个文件夹了吗?Top
2 楼xjxb21(男的糊涂)回复于 2006-06-02 20:47:30 得分 0
jianli la a
建立了啊 。。。。
有语法错误不?
Top




