| Author |
Thread |
| Want to display files in a folder sorted by date created? |
|
Posted in tutorial: Working with Drives, Folders and Files in ASP |
· thinkB
Joined: 16 Dec 2003 Total Posts: 1 |
Want to display files in a folder sorted by date created? Posted: 16 Dec 2003
This was something I was looking for a while. Thanks Faisal!. I would like to display files in a folder sorted by date created? I couldn't figure out the sequence on how the "For Each file in files" loop reads files from the folder. Any Ideas?
|
· Mogadon
Joined: 4 Feb 2004 Total Posts: 2 |
Files in Folder Retrieve Sequence Posted: 4 Feb 2004
The files in the folder will be returned in whatever order they are actually stored in the folder as the operating system reads it. To get a sotred list, save the file information in an array and use a VB qsort routine to sort the array. You may want to include the filename as part of the array key so you can retrieve other file information later: as in:
filearray[i] = <date in yyyymmdd format>|<filename>
<script language="VB"> qsort(filearray, 1, i-1) </script>
(assumes loop on i in getting values for filearray)
You'll have to use VB to pass an array wioth ASP code as VBScript won't pass an array correctly. (or the array must be a global variable).
FYI, Mogadon
|
· ncung47
Joined: 4 Feb 2005 Total Posts: 1 |
new to ASP... Posted: 4 Feb 2005
is there a way to convert Set to an array, and vice versa?
Could you provide more information on this sorting task by date of creation? Would it be a string comparison? I am guessing you'd have to write your own sorting function, correct? Thanks.
|