代碼如下:
<%
set myFile=server.CreateObject("Scripting.FileSystemObject")
Set myFolder=myFile.getFolder(server.mappath("aa/"))
response.write "子文件夾:<br />"
For Each item In myFolder.subFolders
response.write "文件夾名["& item.name &"] "& item &"<br />"
response.write "<hr />"
Next
response.write "文件:<br />"
For Each item In myFolder.files
response.write "[" & item & "]<br />"
response.write "文件名: " & item.name & "<br />"
response.write "文件路徑: " & item.path & " <br />"
response.write "文件大小: " & Round(item.Size/1024,2) & " K字節 <br />" ’Round函數來作四捨五入的操作 忽略返回整數
response.write "<hr />"
Next
%>