关于文件夹中文件列表的程序解析——在线等,立即给分

来源:百度知道 编辑:UC知道 时间:2024/09/23 13:17:36
<%Function ShowFolderList(folderspec)
Dim fso, f, f1, s, sf
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set sf = f.subfolders
For Each f1 in sf
s = s & f1.name
s = s & "<BR>"
Next
ShowFolderList = s
End Function
%>
<%response.Write(ShowFolderList("F\电影\xk"))%>

我想用这段程序显示 F\电影\xk 中所有的文件夹,用绝对路径是可以的,但是用相对路径列出的却不是期望文件夹中的文件,这是为什么啊!请高手指点。在线等,立即给分!

一般地,相对路径是相对于当前文件的,只可能是你路径没写好咯。

你可以用 response.Write 输出server.mappath(相对路径) ,看一下具体是什么,再进一步调试。