Phoenix_1
05-31-2004, 02:10 AM
I want to list all the files within a bunch of subfolders and list them all together in the same page. I have this:
<% Set directory = server.createobject("Scripting.FileSystemObject")
Set listing = directory.GetFolder(Server.MapPath("/dirpath/"))
For Each directoryfile in listing.subfolders
Set listing = directory.GetFolder(Server.MapPath("/dirpath/"&directoryfile.Name))
Next
For Each directoryfile in listing.files %>
<tr>
<td><% =directoryfile.Name %></td>
</tr>
<% Next %>
This works to an extent, but for some reason it ONLY gets the LAST subfolder's files when it should, as far as I know, get all the subfolders' files. Could someone help me out? What am I doing wrong? Thanks in advance.
<% Set directory = server.createobject("Scripting.FileSystemObject")
Set listing = directory.GetFolder(Server.MapPath("/dirpath/"))
For Each directoryfile in listing.subfolders
Set listing = directory.GetFolder(Server.MapPath("/dirpath/"&directoryfile.Name))
Next
For Each directoryfile in listing.files %>
<tr>
<td><% =directoryfile.Name %></td>
</tr>
<% Next %>
This works to an extent, but for some reason it ONLY gets the LAST subfolder's files when it should, as far as I know, get all the subfolders' files. Could someone help me out? What am I doing wrong? Thanks in advance.