Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 Sorting file list from the server.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bobby131313
Senior Member

USA
1163 Posts

Posted - 01 March 2018 :  18:57:48  Show Profile  Visit bobby131313's Homepage  Reply with Quote
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.

Switch the order of your title tags

Edited by - bobby131313 on 01 March 2018 18:58:47

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 02 March 2018 :  11:09:24  Show Profile  Visit HuwR's Homepage  Reply with Quote
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

MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

bobby131313
Senior Member

USA
1163 Posts

Posted - 02 March 2018 :  16:01:45  Show Profile  Visit bobby131313's Homepage  Reply with Quote
Thanks Huw, I'll take a look at that today.

Switch the order of your title tags
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
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