Reverse file-listing.

Results 1 to 2 of 2

Thread: Reverse file-listing.

  1. #1
    Thomas Sjoelin Guest

    Default Reverse file-listing.

    Hi.<BR>I&#039m using asp to list files in a folder for download. My problem is this. I want to reverse the filelist to get the newst file at the top and the oldest file at the bottom. The files all have names with dates, e.g. 001020, 001023 and so on. Can anyone help me with this.<BR><BR>This is the script I&#039m using:<BR><BR>&#060;%<BR>datum = formatdatetime(date,2)<BR>sub listfiles(katalog)<BR>Set fs = CreateObject("Scripting.FileSystemObject")<BR>Set f = fs.GetFolder(server.mappath(katalog))<BR>Set fc = f.Files<BR>For Each fil in fc<BR>filnamn = left(,len(<BR> response.write "&#060;A HREF=&#039" & katalog & "/"<BR> response.write<BR> response.write "&#039&#062;"<BR> response.write filnamn<BR> response.write "&#060;/A&#062;<BR>"<BR>Next<BR>set f = nothing<BR>set fs=nothing<BR>end sub<BR>%&#062;<BR><BR><BR>&#060;%<BR>call listfiles("/test/files")<BR>%&#062;<BR><BR>I would very much appreciate sone insight in how to do this.<BR><BR>/Thomas<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Reverse file-listing.

    Put the file names/date/etc. into an array, sort the array, and then output it. There are several sort examples on the website.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts