[align=left]
<%
option explicit
dim infopath '當(dāng)前路徑
dim serverpath '服務(wù)器路徑
dim objfso '文件組件
dim objfile '文件
dim objfolder '目錄
dim objfoldercontents '所有文件
dim objfoldercount '臨時數(shù)組變量-文件夾
dim objfileitem '臨時數(shù)組變量-文件
dim fsize
function file_size(filesize)
select case true
case filesize<1024
fsize=filesize&" b"
case filesize<1048576
fsize=round((filesize/1024),0)&" kb"
case filesize<1073741824
fsize=round((filesize/1024/1024),0)&" mb"
case else
fsize=round((filesize/1024/1024/1024),0)&" gb"
end select
file_size=fsize
end function
set objfso=createobject("scripting.filesystemobject") '實例文件組件
set objfile=objfso.getfile("e:\wwwroot\file\table.asp") '讀取文件所在路徑
set objfolder=objfile.parentfolder '根據(jù)文件所在路徑得到上級目錄
set objfoldercontents=objfolder.files '所有文件付給數(shù)組
response.write "
"
response.write "文件名 | "
response.write "文件屬性 | "
response.write "文件大小 | "
response.write "更新日期 |
"
for each objfoldercount in objfolder.subfolders '循環(huán)顯示文件夾
response.write "
"&objfoldercount.name&" | " '文件夾名稱
response.write ""&objfoldercount.type&" | " '文件夾屬性
response.write " | "
'文件夾大小
response.write "
"&objfoldercount.datecreated&" | " '時間
next
for each objfileitem in objfoldercontents '循環(huán)
response.write "
"&objfileitem.name&" | "
'文件名
response.write "
"&objfileitem.type&" | " '類型
response.write ""&file_size(objfileitem.size)&" | " '文件大小
response.write ""&objfileitem.datelastmodified&" |
" '更新日期
next
response.write "
"
%>[/align]
該文章在 2010/6/27 17:27:08 編輯過