Sorting IIS Directory Browsing

Posted on 2011-05-10
Last Modified: 2012-05-11
Dear Experts,
I'm trying to implement an simple web page for listing documents within a folder giving the user the possibility to sort files by name, size or date.
So far the best code I found on the internet is this:
The display is fairly nice but it only allows me to sort A->Z not Z->A and I need both.
My server is a Windows 2003 SP2 (IIS6) and I have no plan to migrate to Windows 2008 any time soon.
I have two questions:
Do you have any better way to implement this kind of sorting?
Do you think this could be achieved with JS (in particularly big folders it would come useful to do the sorting client side)?

P.S.: WebDav at the moment is not an option

Thank you,
Question by:martineit
    LVL 8

    Expert Comment

    It may be a good starting point as it builds a record set that you can then loop through to display the data however you need.

    Sorting is by the line
    rsFSO.Sort = "Type DESC, Size ASC "
    A bit of form request and logic would be able to change the sort depending on the links,

    FSO Sort Folder Contants

    Is this the sort of thing your looking for (before I spend while looking at it)
    LVL 1

    Author Comment

    thank you for your answer. I know I could achieve that by using FSO sorting but I wanted to avoid to re-write code, it seems unbelivable to me that noone ever wrote this code.
    I've already found a way to obtain the reverse (z->a) sorting by simply taking the code from the link I posted originally and did a reverse array.
    Now I'm actually more interested in finding a way to do the sorting using JS (to compare the execution time for each solution), has anyone ever done that?


    Expert Comment

    If don't want to rewrite the code, you can try to use the sort in querystring:

    For Example, sort=1 is Z to A

    sort=2 is A to Z

    So by this way you can only add a code to set 2 as default.

    Hope this help.
    LVL 1

    Author Comment

    As I said in my previous post: "I've already found and applied the ASP solution".
    At the moment I would like to find out if it's possible to do the same using JS.

    Any idea?


    Accepted Solution

    As I knew that, classic JS is not a perfect solution for sorting, but I think you can have a look on JQuery, however, basically you might need refine your ASP coding a bit as some sorting is by DIV tag and LI tag ...etc

    Here is some example:

    Hope this help. :)
    LVL 1

    Author Closing Comment

    Doesn't really answer my question and right now I don't have time to "have a look" at something (I was hoping for some ready made piece of code).

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
    If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now