469,923 Members | 1,739 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

Sort list of files in directory

Hello,

I'm beginning in the ASP world...

I would like to sort (descending) list of files in directory.

Parameter is directory url.

How I can to do that with ASP not ASP.NET.

Thank you very much.

Jean-Paul
Jul 19 '05 #1
2 13783
On Tue, 23 Dec 2003 21:16:40 +0100, "Jean-Paul Lauque"
<je**************@wanadoo.fr> wrote:
Hello,

I'm beginning in the ASP world...

I would like to sort (descending) list of files in directory.

Parameter is directory url.


Use the File System Object to retrieve the files collection.
Something like:

==============
' Get the folder needed from a query string
' could be Request.Form or whatever

Folder = Request.QueryString("Folder")

' Use the FSO to get the files collection

Set FileSystem = CreateObject("Scripting.FileSystemObject")
Set DisplayFolder = FileSystem.GetFolder(server.mappath(Folder))
Set DisplayFiles = DisplayFolder.Files

' Display each file on a line in a web page

For Each FileName in Files
response.write FileName.Name & "<br>" & VbCrLf
Next
==============

The files are already sorted descending order, but you could load them
into an array and sort to your heart's content if you wish.

Jeff
Jul 19 '05 #2
And here are some related links:

Directory List (Sorted)
http://www.asp101.com/samples/dir_list_sort.asp
Puts file info into an ADO recordset and then sorts that.

How do I sort a file list alphabetically? - 7/16/2000
http://www.aspfaq.com/show.asp?id=2025

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mike Zupan | last post: by
1 post views Thread by Shawn Mehaffie | last post: by
5 posts views Thread by jr | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.