B
boyd.roberts
Hello All,
I am trying to generate a list of files in a directory on a website,
which only includes a defined list of file extentions.
Below is my code but i have an issue that this only returns the first
file in my includelist.
<%
Dim objFSO, objFile, objFileitem, objFolder, objFolderContents
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(Server.MapPath("."))
Set objFolderContents = objFolder.Files
for each objFileItem in objFolderContents
includelist = "html, asp, php, htm"
arrInclude = split(includelist, ",")
pos = instr(objFileItem.Name, ".")
extension = mid(objFileItem.Name, pos+1, len(objFileItem.Name)-pos)
strinclude = false
if extension = arrInclude(i) then
strinclude = true
end if
if strinclude = true then
%>
<a href="<%=objFileitem.Name%>"><%=objFileitem.Name%></a><br>
<%
end if
next
%>
Hope someone can show me the errors of my ways.
Many Thanks
I am trying to generate a list of files in a directory on a website,
which only includes a defined list of file extentions.
Below is my code but i have an issue that this only returns the first
file in my includelist.
<%
Dim objFSO, objFile, objFileitem, objFolder, objFolderContents
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(Server.MapPath("."))
Set objFolderContents = objFolder.Files
for each objFileItem in objFolderContents
includelist = "html, asp, php, htm"
arrInclude = split(includelist, ",")
pos = instr(objFileItem.Name, ".")
extension = mid(objFileItem.Name, pos+1, len(objFileItem.Name)-pos)
strinclude = false
if extension = arrInclude(i) then
strinclude = true
end if
if strinclude = true then
%>
<a href="<%=objFileitem.Name%>"><%=objFileitem.Name%></a><br>
<%
end if
next
%>
Hope someone can show me the errors of my ways.
Many Thanks