I picked up this useful code from brainjar to parse a set of folders and display hyperlinks to the contents.
It does this really well but also includes the bloody _vti folders that FrontPage leaves lying around in the results.
I know I need to add someting like
to get around it but I'm not sure of the location or correct syntax, the listing page code is below;
TIA
It does this really well but also includes the bloody _vti folders that FrontPage leaves lying around in the results.
I know I need to add someting like
Code:
If InStr(1, objItem, "_vti", 1) = 0 Then
to get around it but I'm not sure of the location or correct syntax, the listing page code is below;
TIA
Code:
<%@ LANGUAGE="VBScript" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<% '***************************************************************************
'* ASP Directory Listing *
'* *
'* Do not remove this notice. *
'* *
'* Copyright 1999, 2000 by Mike Hall. *
'* Please see [URL unfurl="true"]http://www.brainjar.com[/URL] for documentation and terms of use. *
'***************************************************************************
%>
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en" lang="en">
<head>
<title>Oracle Discoverer Reports</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="_style/csog.css">
</head>
<body>
<div id="demoBox">
<h3>Oracle Discoverer Reports</h3>
<p>Listed below are common reports available from Oracle Discoverer.</p>
</div>
<!-- List these three folders. -->
<ul>
<% ListFolderContents(Server.MapPath("AR Accounts Receivable")) %>
<% ListFolderContents(Server.MapPath("AP Accounts Payable")) %>
<% ListFolderContents(Server.MapPath("FA Fixed Assets")) %>
<% ListFolderContents(Server.MapPath("GL General Ledger")) %>
<% ListFolderContents(Server.MapPath("HR Human Resources")) %>
<% ListFolderContents(Server.MapPath("INV Inventory")) %>
<% ListFolderContents(Server.MapPath("OP Project Accounts")) %>
<% ListFolderContents(Server.MapPath("PO Purchasing")) %>
</ul>
</body>
</html>
<% 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("<li><b>" & folder.Name & "</b> - " _
& 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("<ul>" & vbCrLf)
'Display a list of sub folders.
for each item in folder.SubFolders
ListFolderContents(item.Path)
next
'Display a list of files.
for each item in folder.Files
url = MapURL(item.path)
Response.Write("<li><a href=""" & url & """>" & item.Name & "</a> - " _
& item.Size & " bytes, " _
& "last modified on " & item.DateLastModified & "." _
& "</li>" & vbCrLf)
next
Response.Write("</ul>" & vbCrLf)
Response.Write("</li>" & vbCrLf)
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 %>