<% 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 <%= strAbsPath %>

<% 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") %> <% End If Next 'objItem For Each objItem In objFolder.Files %> <% Next 'objItem Set objItem = Nothing Set objFolder = Nothing Set objFSO = Nothing %>
File Name: File Size (bytes): Date Created: File Type:
dir_list.asp?DIR=<%= DirName %>\><%= objItem.Name %> <%= objItem.Size %> <%= objItem.DateCreated %> <%= objItem.Type %>
<%= objItem.Name %> <%= objItem.Size %> <%= objItem.DateCreated %> <%= objItem.Type %>