Sort File List?

Results 1 to 3 of 3

Thread: Sort File List?

  1. #1
    Join Date
    Dec 1969

    Default Sort File List?

    I have a routine that displays folder names, and allows the user to click on them to download them. Problem is that the folder&#039;s appear in almost random order. How can I sort it before displaying the list? Here&#039;s the code I&#039;m using so far:<BR><BR>Dim objFolder<BR>Set objFolder = objFSO.GetFolder(HomeFolder & cDir)<BR><BR>&#039; If I found a lesson.ini file in this folder, then it&#039;s a lesson folder,<BR>&#039; we need to zip up the contents for download<BR>Dim objFile, lIsLesson<BR>lIsLesson = False<BR>For Each objFile in objFolder.Files<BR> &#039;Print out the name<BR> if UCase(objFile.Name) = "LESSON.INI" then<BR> lIsLesson = True<BR> Exit For<BR> end if<BR>Next<BR><BR>if lIsLesson then<BR> cDir = Replace(cDir,"/","\")<BR> Response.Write "Click &#060;a href=frmDownload.asp?Path=" & Server.URLEncode(HomeFolder & cDir & "\") & "&Name=" &_<BR> Server.URLEncode(cDir) & "&#062;HERE&#060;/a&#062; to download " & cDir & "<BR><BR>" &_<BR> "Once you click on the above link, there will be a short delay while the files are zipped, " &_<BR> "then you will be asked where to save the file."<BR><BR>else<BR> &#039; Use a For Each ... Next loop to display the folders<BR> Dim objSubFolder, cDir1<BR> For Each objSubFolder in objFolder.SubFolders<BR> &#039; Print out the name<BR> if cDir = "/" then<BR> cDir1 = ""<BR> else<BR> cDir1 = cDir<BR> end if<BR> Response.Write "&#060;img src=Folder.gif&#062;***&#060;a href=gmil.asp?Dir=" & Server.URLEncode(cDir1) & "/" &_<BR> Server.URLEncode(objSubFolder.Name) & "&#062;" & objSubFolder.Name & "&#060;/a&#062;<BR>"<BR> Next<BR>end if<BR><BR>Any help is appreciated.

  2. #2
    Join Date
    Dec 1969

    Default ASPFAQs, category FileSystemObject

    The link to the ASPFAQs is at the top right corner of this very page, so you can find answers to FAQs like this one.<BR><BR>Look in the named category for an FAQ that is relevant to your question.<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default Hey Bill...

    could you take a look at my onclick() post that is 2 down from this one. I want to know what you think?? Bad idea or what to use an alert box to tell the user the link isn&#039; able to be accessed...<BR><BR>thanks alot!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts