<% foreach (var dir in new DirectoryInfo("C:/Photos").GetDirectories()) { %>
<table cellpadding = "5" border = "5"><tr>
<td><img src="FolderIcon1.png" alt = "icon" height = "100" width = "100"/></td>
<td> Directory: <%= dir.Name %><br /></td>
</tr>
<tr>
<td> <img src="sparrow34.jpg" alt = "sparrow" height = "50" width = "50"/></td>
<% foreach (var file in dir.GetFiles()) { %>
<td> File name: <%= file.Name %> </td>
<% } %>
<% } %></tr>
</table>
<%int fCount = Directory.GetFiles("C:/Photos", "*.*", SearchOption.AllDirectories).Length; %>
<%Response.Write(fCount); %>
</div>
I have written above code and able to display each folder in a folder column however all the files of particular folder are displayed in single column rather than single column for each file. I know I should be using FileInfo[] but I am not able to get the actual code. Please help in this regard.
sai.ande
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.