<% dim localURL localURL="/ayearofsongs/2005/09/" %>


MASTER FILE LIST

<% CONST FILE_NAME = 0 ' CONST FILE_EXT = 1 ' CONST FILE_TYPE = 2 CONST FILE_SIZE = 3 ' PLAYING HERE CONST FILE_CREATED = 1 CONST FILE_MODIFIED = 5 CONST FILE_ACCESSED = 6 ' get requested sort order, if not first time here... ' (forward by name is default) req = Request("sortBy") If Len(req) < 1 Then sortBy = 1 Else sortBy = CInt(req) req = Request("priorSort") If Len(req) < 1 Then priorSort = -1 Else priorSort = CInt(req) ' ' did user ask for same sort? to reverse the order? ' but if so, then zap priorSort so clicking again will do forward! If sortBy = priorSort Then reverse = true priorSort = -1 Else reverse = false priorSort = sortBy End If path = Server.MapPath(localURL) Set fso = CreateObject("Scripting.FileSystemObject") Set theCurrentFolder = fso.GetFolder( path ) Set curFiles = theCurrentFolder.Files ' ' And now a loop for the files ' Dim theFiles( ) ReDim theFiles( 500 ) ' arbitrary size! currentSlot = -1 ' start before first slot For Each fileItem in curFiles fname = fileItem.Name fext = InStrRev( fname, "." ) If fext < 1 Then fext = "" Else fext = Mid(fname,fext+1) ftype = fileItem.Type fsize = fileItem.Size fcreate = (DateAdd("h",-3,fileItem.DateCreated )) fmod = fileItem.DateLastModified faccess = fileItem.DateLastAccessed currentSlot = currentSlot + 1 If currentSlot > UBound( theFiles ) Then ReDim Preserve theFiles( currentSlot + 99 ) End If ' note that what we put here is an array! theFiles(currentSlot) = Array(fname,fcreate) Next fileCount = currentSlot ReDim Preserve theFiles( currentSlot ) If VarType( theFiles( 0 )( sortBy ) ) = 8 Then If reverse Then kind = 1 Else kind = 2 ' sorting strings... Else If reverse Then kind = 3 Else kind = 4 ' non-strings (numbers, dates) End If For i = fileCount TO 0 Step -1 minmax = theFiles( 0 )( sortBy ) minmaxSlot = 0 For j = 1 To i Select Case kind ' which kind of sort are we doing? ' after the "is bigger/smaller" test (as appropriate), ' mark will be true if we need to "remember" this slot... Case 1 ' string, reverse...we do case INsensitive! mark = (strComp( theFiles(j)(sortBy), minmax, vbTextCompare ) < 0) Case 2 ' string, forward...we do case INsensitive! mark = (strComp( theFiles(j)(sortBy), minmax, vbTextCompare ) > 0) Case 3 ' non-string, reverse ... mark = (theFiles( j )( sortBy ) < minmax) Case 4 ' non-string, forward ... mark = (theFiles( j )( sortBy ) > minmax) End Select ' so is the current slot bigger/smaller than the remembered one? If mark Then ' yep, so remember this one instead! minmax = theFiles( j )( sortBy ) minmaxSlot = j End If Next ' is the last slot the min (or max), as it should be? If minmaxSlot <> i Then ' nope...so do the needed swap... temp = theFiles( minmaxSlot ) theFiles( minmaxSlot ) = theFiles( i ) theFiles( i ) = temp End If Next %>

A Year of Songs began on the Autumn Equinox 2006

click on column header to sort or reverse sort
<% For i = 0 To fileCount Response.Write "" & vbNewLine For j = 0 To UBound( theFiles(i) ) Response.Write " " & vbNewLine Next Response.Write "" & vbNewLine Next %>
File name Created
" & theFiles(i)(j) & "

 

MASTER FILE LIST