ASP 取得目錄 & 檔案 & 檔案資訊 FileSystemObject
直接給CODE
Dim objFSO , objFolder , objFile
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(Server.MapPath("\目錄")) then
Set objFolder = objFSO.GetFolder(Server.MapPath("\目錄"))
For Each objFile in objFolder.SubFolders
Response.Write("子目錄:")
Response.Write objFile.Name & "<BR>"
Next
For Each objFile in objFolder.Files
Response.Write("檔案:")
Response.Write objFile.Name & "<BR>"
Next
End if
Set objFolder = nothing
Set objFSO = nothing