SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    displaying files from a folder in a descending order

    Hey guys, how can i display photos that are just stored in a folder (no relation to any DB or so) in a descending order?

    this is the code:
    Code:
    <%
    sID = 0
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFSO.GetFolder(Server.MapPath("db/Photos/"))
    For Each objFile in objFolder.Files
     sFile = LCase (objFile.Name)
     If Right (sFile,4) = ".jpg" or Right (sFile,4) = ".bmp" or Right (sFile,4) = ".png" or Right (sFile,4) = ".gif" or Right (sFile,4) = "jpeg" Then 
      %>
      ["<% Response.Write sID %>" , "<% Response.Write objFile.Name %>" , "<% Response.Write objFile.DateLastModified %>"],
      <%
     End If
     sID = sID + 1
    Next
    Set objFolder = Nothing
    Set objFSO = Nothing
    %>

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    One way to do this is to put the details into a client recordset (i.e. a recordset created without a database), then .Sort the recordset on the FileName field, then loop through the recordset to display the info.

    http://www.google.co.uk/search?q=asp...recordset+sort <<< Your starter for 10
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could also use the dictionary object to hold the file names and sort it from there

    http://support.microsoft.com/kb/246067


Bookmarks

Posting Permissions

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