by Matt Massey (4 Submissions)
Category: Active Server Pages
Compatability: ASP (Active Server Pages)
Difficulty: Unknown Difficulty
Originally Published: Sun 31st January 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Lists all file within the current directory.
<head><title></title></head>
<body>
<%
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
TheFile = Server.MapPath(Request.ServerVariables("SCRIPT_NAME"))
loc = InStrRev(TheFile,"\")
TheFile = Left(TheFile,loc)
Set f = fso.GetFolder(TheFile)
Set fc = f.Files
For Each f1 in fc
'change the file extensions to view different files.
if right(f1,5) = ".html" or right(f1,4) = ".htm" then
s = s & "<A HREF='" & f1.name & "'>" & f1.name & "</A>"
s = s & "<BR>"
End If
Next
ShowFileList = s
%>
<%
response.write ShowFileList
%>
</body>
</html>