Ver Mensaje Individual
  #8 (permalink)  
Antiguo 30/07/2003, 04:52
Avatar de AlexNV
AlexNV
 
Fecha de Ingreso: junio-2003
Ubicación: Madrid
Mensajes: 289
Antigüedad: 21 años, 10 meses
Puntos: 1
Otra forma es crearte un recordset, rellenarlo con los datos del filesystem y luego ordenarlo. Aquí tienes un ejemplo, que te muestra el nombre del fichero, el tamaño y la fecha y lo ordena por fecha descendentemente, pero lo puedes ordenar por el campo que quieras.

Código:
Dim objFSO
Dim objFolder
Dim strPath
Dim objItem

strPath = "./"
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(Server.MapPath(strPath))


dim cont
cont = 0
dim fecha
dim rs
Set rs = Server.CreateObject("ADODB.Recordset")

rs.Fields.Append "FileName", 8, 80
rs.Fields.Append "FileSize", 5
rs.Fields.Append "FileDate", 133

rs.Sort = "FileDate desc"
rs.Open

For Each objItem In objFolder.Files
		rs.addnew 
		rs.Fields("FileName").Value = objItem.Name
		rs.Fields("FileSize").Value = (objItem.Size/1024) + .5
		rs.Fields("FileDate").Value = cdate(objItem.DateLastModified)
		rs.Update
next

Set objItem = Nothing
Set objFolder = Nothing
Set objFSO = Nothing

response.write("<table border=0 width=80% bgcolor=white cellpadding=1 cellspacing=1>")

if not rs.eof then rs.movefirst
do while not rs.eof
		if cont = 0 then
			response.write("<tr bgcolor=#006699 >")
			response.write("<td colspan=2 align='center'><font color='white'>Nombre de fichero")
			response.write("<td align='center'><font color='white'>Tamaño")
			response.write("<td align='right'><font color='white'>Fecha")
			response.write("</tr>")
		end if
		response.write ("<tr>")
		response.write ("<td align='right'><img src='../imag/flecha2.gif' width=9 height=9>")
		response.write ("<td align='left'><a href='" & strpath & rs.fields("FileName").Value & "' border=0>" & rs.fields("FileName").Value  )
		response.write ("<td align='center'>" & Int(rs.fields("FileSize").Value ) &  " Kb")
		fecha = rs.fields("FileDate").Value 
		response.write ("<td align='right'>" & day(cdate(fecha)) & "/" & month(cdate(fecha)) & "/" & year(cdate(fecha)))
		'response.write ("<td>" & FormatDateTime(CDate(objItem.DateLastModified),0) )
		cont = cont + 1
		rs.MoveNext 
Loop
if cont=0 then
	response.write ("<td align='center'><font color=#006699>No existen ficheros disponibles</font>")
end if

response.write("</table>")
rs.close
set rs = nothing