如何得到服务器上指定目录下的所有文件的名称?

yaojr21 2003-08-19 10:28:08
dim MyFileObject
dim temp
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")temp=MyFileObject.GetFileName ("F:\test\")
为什么temp的值是"test"是文件夹的名称,而不是该文件夹下的所有文件的名称嘛?请指教!
...全文
57 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
凯晰叶子 2003-08-19
  • 打赏
  • 举报
回复
temp=MyFileObject.GetFileName ("F:\test\")
这句得到的是TEST名!?
你把源文件全写出来!
Brookes 2003-08-19
  • 打赏
  • 举报
回复
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
Set objFolder1 = fso.GetFolder(path)
' Iterate through all the files in this folder
For Each objFile in objFolder1.Files
Response.Write "Name: " & objFile.Name & "   "
Response.Write "ShortName: " & objFile.ShortName & "   "
Response.Write "Size: " & objFile.Size & " bytes    "
Response.Write "Type: " & objFile.Type & "<BR>"
Response.Write "Path: " & objFile.Path & "   "
Response.Write "ShortPath: " & objFile.ShortPath & "<BR>"
Response.Write "Created: " & objFile.DateCreated & "   "
Response.Write "LastModified: " & objFile.DateLastModified & "<P>"
Next

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧