Versione aggiornata:
codice:
<%
path = "20080202"
pathMapped = server.mapPath(path)
if right(path,1) <> "/" then path = path & "/"
page = request.queryString("page")
if len(page) > 0 then
page = cLng(page)
else
page = 1
end if
dim filesList()
filesPerPage = 10
cnt = 0
function getFileProperties(theFile, theProperty)
set theFso = server.createObject("Scripting.FileSystemObject")
set theFile = theFso.getFile(theFile)
select case theProperty
case "DateCreated"
getFileProperties = theFile.DateCreated
case "DateLastAccess"
getFileProperties = theFile.DateLastAccess
case "DateLastModified"
getFileProperties = theFile.DateLastModified
case "Drive"
getFileProperties = theFile.Drive
case "Name"
getFileProperties = theFile.Name
case "ParentFolder"
getFileProperties = theFile.ParentFolder
case "Path"
getFileProperties = theFile.Path
case "ShortName"
getFileProperties = theFile.ShortName
case "Size"
getFileProperties = theFile.Size
case "Type"
getFileProperties = theFile.Type
end select
set theFile = nothing
set theFso = nothing
end function
set fso = server.createObject("Scripting.FileSystemObject")
set folder = fso.getFolder(pathMapped)
set files = folder.files
for each file in files
reDim preserve filesList(cnt)
filesList(cnt) = file.name
cnt = cnt + 1
next
set files = nothing
set folder = nothing
set fso = nothing
totalFiles = uBound(filesList) + 1
totalPages = int(totalFiles / filesPerPage)
temp = totalPages * filesPerPage
if (totalFiles - temp) > 0 then totalPages = totalPages + 1
response.write "Pagine: "
for p = 1 to totalPages
if p = page then
response.write p & " "
else
response.write "" & p & " "
end if
next
response.write "<hr />"
i = (page * filesPerPage) - filesPerPage
loops = 0
response.write "<ul>"
response.write "[*]Elenco file della cartella '" & path & "'.
"
response.write "File Totali: " & totalFiles & "
"
response.write "Pagina " & page & "/" & totalPages
response.write "<ul>"
for f = i to uBound(filesList)
if loops = filesPerPage then exit for
response.write "[*]" & filesList(f) & "
"
response.write "Data di creazione: " & getFileProperties(pathMapped & "\" & filesList(f), "DateCreated") & "
"
response.write "Data ultima modifica: " & getFileProperties(pathMapped & "\" & filesList(f), "DateLastModified") & "
"
response.write "Dimensione del file: " & getFileProperties(pathMapped & "\" & filesList(f), "Size") & " byte
"
response.write "Tipo di file: " & getFileProperties(pathMapped & "\" & filesList(f), "Type") & "
"
response.write ""
loops = loops + 1
next
response.write "[/list]"
response.write "[/list]"
response.write "<hr />"
response.write "Pagine: "
for p = 1 to totalPages
if p = page then
response.write p & " "
else
response.write "" & p & " "
end if
next
%>