Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 Sorting file list from the server.

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
bobby131313 Posted - 01 March 2018 : 18:57:48
So I created a page so users can see and reuse their previously uploaded images, the code below grabs the file list (FileList).

Dim fs, f, Folder, fc, s, File, FileList, FolderInfo, FileName, Name
Set FolderInfo = Fso.GetFolder(PathSpec)
Set FileList = FolderInfo.Files
intFiles = FileList.Count
intFSize = FolderInfo.Size


This grabs them in the normal windows order. Given the time stamping during upload the oldest ones are always first so users with hundreds of images have to always go to the last page and scroll to the end to get recent images.

I have spent a month or so off and on googling trying to flip the order so the recent ones will be first.

Is this possible? Thanks in advance.
2   L A T E S T    R E P L I E S    (Newest First)
bobby131313 Posted - 02 March 2018 : 16:01:45
Thanks Huw, I'll take a look at that today.
HuwR Posted - 02 March 2018 : 11:09:24
you need to put them in an array or a recordset object and then sort that.

Something along the line of

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.CursorLocation = 3 ' adUseClient
objRS.Fields.Append "Name", 200, 50 ' adVarChar
objRS.Fields.Append "created", 7 ' adDate
objRS.Open
 
imagespath = "C:\inetpub\wwwroot\_images\"
 
Dim FSObj, FOlderObj, FileCollObj
Set FSObj = Server.CreateObject("Scripting.FileSystemObject")
 
Set FolderObj = FSObj.GetFolder(imagespath)
Set FolderCollObj = FolderObj.SubFolders
For Each item in FolderCollObj
Set SubFolderObj = FSObj.GetFolder(FolderObj & "/" & item.name)
objRS.AddNew
objRS("Name") = item.name
objRS("created") = SubFolderObj.DateCreated
Next
objRS.Sort = "created DESC"
objRS.MoveFirst
Do UNTIL objRS.EOF
response.write "<a href=""gallery.asp?gallery=" & objRS(0) & """>"
response.write objRS(0) & " <BR><BR></A>"
objRS.movenext
Loop

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000 Version 3.4.07