Salve a tutti.
Ho provato questo script
codice:
<%@ LANGUAGE="VBScript" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" lang="it">
<head>
<title>ASP Directory Listing </title>
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="image/style.css">
<link href="images/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h3>Directory Listing </h3>
<ul>
<% ListFolderContents(Server.MapPath("/public/allegati")) %>[/list]
</body>
</html>
<% sub ListFolderContents(path)
dim fs, folder, file, item, url
set fs = CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder(path)
'Display the target folder and info.
Response.Write("[*]" & folder.Name & " - " _
& folder.Files.Count & " files, ")
if folder.SubFolders.Count > 0 then
Response.Write(folder.SubFolders.Count & " directory, ")
end if
Response.Write(Round(folder.Size / 1024) & " KB totali." _
& vbCrLf)
Response.Write("<ul>" & vbCrLf)
'Display a list of sub folders.
for each item in folder.SubFolders
ListFolderContents(item.Path)
next
'Display a list of files.
for each item in folder.Files
data_modifica = left((item.DateLastModified), 10)
dimensioni = int(item.Size/1024)
url = MapURL(item.path)%>
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10">[*]</td>
<td width="220"><%Response.Write("" & item.Name & "")%></td>
<td width="70"><%Response.Write(dimensioni & " KB")%></td>
<td width="120"><%Response.Write(data_modifica)%></td>
</tr>
</table><%
next
Response.Write("[/list]" & vbCrLf)
Response.Write("" & vbCrLf)
end sub
function MapURL(path)
dim rootPath, url
'Convert a physical file path to a URL for hypertext links.
rootPath = Server.MapPath("/")
url = Right(path, Len(path) - Len(rootPath))
MapURL = Replace(url, "\", "/")
end function %>
il quale mi stampa a video i file di una directory.
Tutto perfetto.
Ma sono in ordine alfabetico e non in ordine di caricamento sul server/ultima modifica.
Mi potete dare qualke dritta su come giocare con la data per riordinare tutti i file?
Grazie in anticipo