I'm stumped?! I have this script calling a bunch of PDF's from a folder and then removing the ".pdf" extention. The results appear in Ascending order - how do I change it to appear in descending order? <% set FileSysObj=CreateObject("Scripting.FileSystemObject") strFileAndPath = request.servervariables("SCRIPT_NAME") strPathOnly = strPathOnlyPlus & "blueprint/" strPathOnlyPlus = Mid(strFileAndPath,1 ,InStrRev(strFileAndPath, "/")) strFullPath = server.mappath(strPathOnly) set fldr=FileSysObj.GetFolder(strFullPath) set FileList = fldr.Files For Each FileIndex in FileList 'This bit excludes this page (and other asp files) from the list of links if Lcase(right(FileIndex.Name, 4)) = ".pdf" then Dim issue issue = Left(FileIndex.name,Len(FileIndex.name)-4) Response.Write("<li><A HREF='blueprint/" & FileIndex.name & "'>Download " & issue & "</A></li>") end if Next %> Code (markup): Many Thanks, Andrew
Guess you could store all the items in an array, then dump them out afterwards. For i = ubound(myarray) to lbound(myarray) step -1 Response.write myarray(i) loop Or Store everything you were going to response.write into a var, but allways add the new value to the start. mybuffer = newvalue & mybuffer Then just output the buffer.
Here is some code that should do the trick <% set FileSysObj=CreateObject("Scripting.FileSystemObject") strFileAndPath = request.servervariables("SCRIPT_NAME") strPathOnly = strPathOnlyPlus & "blueprint/" strPathOnlyPlus = Mid(strFileAndPath,1 ,InStrRev(strFileAndPath, "/")) strFullPath = server.mappath(strPathOnly) set fldr=FileSysObj.GetFolder(strFullPath) set FileList = fldr.Files I = FileList.count dim tmpFileNames() redim tmpFileNames(I) I = 1 For Each FileIndex in FileList tmpFileNames(I) = fileobj.name I = I +1 Next Dim issue for I = ubound(tmpFileNames) to 1 step -1 if Lcase(right(tmpFileNames(i), 4)) = ".pdf" then issue = Left(tmpFileNames(i),Len(tmpFileNames(i))-4) Response.Write("<li><A HREF='blueprint/" & tmpFileNames(i) & "'>Download " & issue & "</A></li>") end if next %> Code (markup):