Link to home
Start Free TrialLog in
Avatar of martineit
martineitFlag for France

asked on

Sorting IIS Directory Browsing

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: http://www.daleanderson.ca/edb/ 
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,
Roberto.
Avatar of GundogTrainer
GundogTrainer

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)
Avatar of martineit

ASKER

Hi,
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?

Thanks,
Roberto.
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
http://www.daleanderson.ca/edb/download/Default.asp?sort=1&FolderSpec=%2Fedb%2Fdownload

sort=2 is A to Z
http://www.daleanderson.ca/edb/download/Default.asp?sort=2&FolderSpec=%2Fedb%2Fdownload

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

Hope this help.
Hello,
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?

Thanks,
Roberto.
ASKER CERTIFIED SOLUTION
Avatar of ericfkw
ericfkw

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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).