<%
'ASP FSO读取XX文件夹下的所有文件与创建使用时间
Dim oFSO, oCurrentFolder, oFolders, oFolder, oFiles, oFile
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
Set oCurrentFolder = oFSO.GetFolder( "G:/wwwroot/admin" )
Set oFolders = oCurrentFolder.SubFolders
Set oFiles = oCurrentFolder.Files
Dim tmpDateStr,tmpNameStr,tmpDates,tmpNames,td,tn
Dim i,j,k
tmpDateStr = ""
tmpNameStr = ""
For Each oFile in oFiles
Response.Write(oFile.name & " -- " & oFile.DateLastModified & "<br/>")
tmpDateStr = tmpDateStr & oFile.DateLastModified & "|"
tmpNameStr = tmpNameStr & oFile.name & "|"
Next
tmpDates = Split(tmpDateStr,"|")
tmpNames = Split(tmpNameStr,"|")
k = UBound(tmpDates)-1
'order
For i=0 To k
For j=0 To k
If j=k Then Exit For
If tmpDates(j)<tmpDates(j+1) Then
td = tmpDates(j)
tn = tmpNames(j)
tmpDates(j) = tmpDates(j+1)
tmpNames(j) = tmpNames(j+1)
tmpDates(j+1) = td
tmpNames(j+1) = tn
End If
Next
Next
'Response
Response.Write("<p>-------------------------</p>")
For i=0 To k
Response.Write(tmpNames(i) & " -- " & tmpDates(i) & "<br/>")
Next
%>