<%@LANGUAGE="VBSCRIPT"%> <% Option Explicit On Error Resume Next ' declare variables Dim objFSO, objFolder Dim objCollection, objItem Dim strPhysicalPath, strTitle, strServerName Dim strPath, strTemp Dim strName, strFile, strExt, strAttr Dim intSizeB, intSizeK, intAttr, dtmDate ' declare constants Const vbReadOnly = 1 Const vbHidden = 2 Const vbSystem = 4 Const vbVolume = 8 Const vbDirectory = 16 Const vbArchive = 32 Const vbAlias = 64 Const vbCompressed = 128 ' don't cache the page Response.AddHeader "Pragma", "No-Cache" Response.CacheControl = "Private" ' get the current folder URL path strTemp = Mid(Request.ServerVariables("URL"),2) strPath = "" Do While Instr(strTemp,"/") strPath = strPath & Left(strTemp,Instr(strTemp,"/")) strTemp = Mid(strTemp,Instr(strTemp,"/")+1) Loop strPath = "/" & strPath ' build the page title strServerName = UCase(Request.ServerVariables("SERVER_NAME")) strTitle = "Contents of the " & strPath & " folder" ' create the file system objects strPhysicalPath = Server.MapPath(strPath) Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(strPhysicalPath) %> <%=strServerName%> - <%=strTitle%>

Lava Dome Stories

<% '''''''''''''''''''''''''''''''''''''''' ' output the folder list '''''''''''''''''''''''''''''''''''''''' Set objCollection = objFolder.SubFolders For Each objItem in objCollection strName = objItem.Name strAttr = MakeAttr(objItem.Attributes) dtmDate = CDate(objItem.DateLastModified) If NOT ((strName = "default.asp") Or (strName = "_vti_cnf")) Then %> <% End If Next %> <% '''''''''''''''''''''''''''''''''''''''' ' output the file list '''''''''''''''''''''''''''''''''''''''' Set objCollection = objFolder.Files For Each objItem in objCollection strName = objItem.Name strFile = Server.HTMLEncode((strName)) intSizeB = objItem.Size intSizeK = Int((intSizeB/1024) + .5) If intSizeK = 0 Then intSizeK = 1 strAttr = MakeAttr(objItem.Attributes) strName = Ucase(objItem.ShortName) If Instr(strName,".") Then strExt = Right(strName,Len(strName)-Instr(strName,".")) Else strExt = "" dtmDate = CDate(objItem.DateLastModified) If NOT ((strFile = "default.asp") Or (strFile = "_vti_cnf")) Then %> <% End If Next %>
Name Size Date Time
<%=strName%> DIRECTORY <%=FormatDateTime(dtmDate,vbShortDate)%> <%=FormatDateTime(dtmDate,vbLongTime)%>
<%=strFile%> <%=intSizeK%>K <%=FormatDateTime(dtmDate,vbShortDate)%> <%=FormatDateTime(dtmDate,vbLongTime)%> 
<% Set objFSO = Nothing Set objFolder = Nothing ' this adds the IIf() function to VBScript Function IIf(i,j,k) If i Then IIf = j Else IIf = k End Function ' this function creates a string from the file atttributes Function MakeAttr(intAttr) MakeAttr = MakeAttr & IIf(intAttr And vbArchive,"A","-") MakeAttr = MakeAttr & IIf(intAttr And vbSystem,"S","-") MakeAttr = MakeAttr & IIf(intAttr And vbHidden,"H","-") MakeAttr = MakeAttr & IIf(intAttr And vbReadOnly,"R","-") End Function %>