<%@ LANGUAGE="VBScript" %> <% '*************************************************************************** '* ASP Directory Listing * '* * '* Do not remove this notice. * '* * '* Copyright 1999, 2000 by Mike Hall. * '* Please see http://www.brainjar.com for documentation and terms of use. * '*************************************************************************** %> damascus road | mailing list archive

<% ListFolderContents(Server.MapPath("/asp/listserv/archive/")) %>

<% sub ListFolderContents(path) dim fs, folder, file, item, url set fs = CreateObject("Scripting.FileSystemObject") set folder = fs.GetFolder(path) 'Display the target folder and info. Response.Write("" & folder.Name & " - " & folder.Files.Count & " files, ") if folder.SubFolders.Count > 0 then Response.Write(folder.SubFolders.Count & " directories, ") end if Response.Write(Round(folder.Size / 1024) & " KB total." & vbCrLf) Response.Write("
") 'Display a list of sub folders. for each item in folder.SubFolders ListFolderContents(item.Path) next 'Display a list of files. Dim tmpName, tmpMonth, tmpDay, tmpYear, txtDate, txtMonth for each item in folder.Files url = MapURL(item.Path) tmpName=item.Name If (tmpName = "default.asp") Then tmpName = "default.asp" Else tmpMonth=Mid(tmpName,1,2) tmpDay=Mid(tmpName,3,2) tmpYear=Mid(tmpName,5,2) If (tmpDay < 10) Then tmpDay=Mid(tmpDay,2,1) End If Select Case tmpMonth Case "01": txtMonth = "January" Case "02": txtMonth = "February" Case "03": txtMonth = "March" Case "04": txtMonth = "April" Case "05": txtMonth = "May" Case "06": txtMonth = "June" Case "07": txtMonth = "July" Case "08": txtMonth = "August" Case "09": txtMonth = "September" Case "10": txtMonth = "October" Case "11": txtMonth = "November" Case "12": txtMonth = "December" Case Else: txtMonth = "Smarch" End Select txtDate = txtMonth & " " & tmpDay & ", 20" & tmpYear Response.Write("" & txtDate & "
") End If next end sub function MapURL(path) dim rootPath, url 'Convert a physical file path to a URL for hypertext links. rootPath = Server.MapPath("/") url = Right(path, Len(path) - Len(rootPath)) MapURL = Replace(url, "\", "/") end function %>