<%
Dim strPath   'Path of directory to show
Dim strAbsPath 'User entered path
Dim objFSO    'FileSystemObject variable
Dim objFolder 'Folder variable
Dim objItem   'Variable used to loop through the contents of the folder
Dim DirName

' NOTE: As currently implemented, this needs to end with the /
strPath = "./"

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

If Request.QueryString("DIR") <> "" Then
	Set strAbsPath = Request.QueryString("DIR")
Else
	strAbsPath = Server.MapPath(strPath)
End If

Set objFolder = objFSO.GetFolder(strAbsPath)
%>

Contents of <B><%= strAbsPath %></B><BR>

<BR>

<TABLE BORDER="5" BORDERCOLOR="green" CELLSPACING="0" CELLPADDING="2">
<TR BGCOLOR="#006600">
<TD><FONT COLOR="#FFFFFF"><B>File Name:</B></FONT></TD>
<TD><FONT COLOR="#FFFFFF"><B>File Size (bytes):</B></FONT></TD>
<TD><FONT COLOR="#FFFFFF"><B>Date Created:</B></FONT></TD>
<TD><FONT COLOR="#FFFFFF"><B>File Type:</B></FONT></TD>
</TR>
<%

For Each objItem In objFolder.SubFolders
	' Deal with the stupid VTI's that keep giving our visitors 404's
If InStr(1, objItem, "_vti", 1) = 0 Then
DirName = replace (strAbsPath," ","%20") & replace(objItem.Name," ","%20")
	%>
<TR BGCOLOR="#CCFFCC">
<TD ALIGN="left" ><A HREF=<%= strPath %>dir_list.asp?DIR=<%= DirName %>\><%= objItem.Name %></A></TD>
<TD ALIGN="right"><%= objItem.Size %></TD>
<TD ALIGN="left" ><%= objItem.DateCreated %></TD>
<TD ALIGN="left" ><%= objItem.Type %></TD>
</TR>
<%
	End If
Next 'objItem

For Each objItem In objFolder.Files
%>
<TR BGCOLOR="#CCFFCC">
<TD ALIGN="left" ><%= objItem.Name %></A></TD>
<TD ALIGN="right"><%= objItem.Size %></TD>
<TD ALIGN="left" ><%= objItem.DateCreated %></TD>
<TD ALIGN="left" ><%= objItem.Type %></TD>
</TR>
<%
Next 'objItem

Set objItem = Nothing
Set objFolder = Nothing
Set objFSO = Nothing

%>
</TABLE>
