by S. de Vreede (1 Submission)
Category: Active Server Pages
Compatability: ASP (Active Server Pages)
Difficulty: Unknown Difficulty
Originally Published: Tue 30th October 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Display a Server-side Directory
'########################################################
' Script: Display a directory
' Author: S. de Vreede
'
' E-mail: [email protected]
' Date: 30 October 2001
'########################################################
%>
<html>
<head>
<title></title>
</head>
<body>
<%
dim strPathInfo, strPhysicalPath
dim objFSO, objFile, objFileItem, objFolder, objFolderContents
strPathInfo = request.ServerVariables("PATH_INFO")
strPhysicalPath = Server.MapPath(strPathInfo)
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.getfile(strPhysicalPath)
set objFolder = objFile.ParentFolder
set objFolderContents = objFolder.Files
%>
<table cellpadding=5>
<tr align=center>
<th align=left>File Name</th>
<th align=left>File Size</th>
<th align=left>File Type</th>
<th align=left>Date Created</th>
</tr>
<%
for each objFileItem in objFolderContents
response.write("<tr><td align=left>")
response.write("<a href='" & objFileItem.Name & "'>" & objFileItem.Name & "</a>")
response.write("</td><td align=right>")
response.write(objFileItem.Size)
response.write("</td><td align=right>")
response.write(objFileItem.Type)
response.write("</td><td align=right>")
response.write(objFileItem.DateCreated)
response.write("</td></tr>")
next
%>
</table>
</body>
</html>