冒泡法:
<%
dim folderPath
folderPath = "D:\Inetpub\wwwroot\test" '修改成你要的路径,对这个路径下的文件按日期排列
dim fso,f
set fso=server.CreateObject("Scripting.filesystemobject")
set fld=fso.Getfolder(folderPath)
for each f in fld.files
dd=f.DateLastModified
dd1=year(dd)&"-"&right("0"&month(dd),2)&"-"&right("0"&day(dd),2)&" "
str=str&dd1&f.name&"|"
'response.write f.DateLastModified&f.name &"<br/>"
next
tmp=split(str,"|")
for j=0 to ubound(tmp)
str1=""
for i=0 to ubound(tmp)
if i=ubound(tmp) then exit for
if tmp(i)<=tmp(i+1) then
tt=tmp(i)
tmp(i)=tmp(i+1)
tmp(i+1)=tt
end if
str1=str1&tmp(i)&"|"
next
next
tmp1=split(str1,"|")
for k= 0 to ubound(tmp1)-1
num1=num1+1
response.write num1&". "&tmp1(k)&"<br/>"
next%>
<%
whichfile=Server.MapPath("testfile.txt")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.CreateTextFile(whichfile,true)
f1.Write ("This is a test.My Name is cnbruce.")
f1.Close
Set f2 = fso.GetFile(whichfile)
s = "文件名称:" & f2.name & "<br>"
s = s & "文件短路径名:" & f2.shortPath & "<br>"
s = s & "文件物理地址:" & f2.Path & "<br>"
s = s & "文件属性:" & f2.Attributes & "<br>"
s = s & "文件大小: " & f2.size & "<br>"
s = s & "文件类型: " & f2.type & "<br>"
s = s & "文件创建时间: " & f2.DateCreated & "<br>"
s = s & "最近访问时间: " & f2.DateLastAccessed & "<br>"
s = s & "最近修改时间: " & f2.DateLastModified
response.write(s)
%>