I have a virtual folder with images like this: "../images/files/"
I need to read the folder content, file names and count.
How do I do that? :eek2:
Thank ya all!!
Printable View
I have a virtual folder with images like this: "../images/files/"
I need to read the folder content, file names and count.
How do I do that? :eek2:
Thank ya all!!
Take a look at the DirectoryInfo class and FileInfo class. THose would be the place to start. If you have any questions with them, let me know and I will help where I can.
how does that work in virtual directory?? "../folder/subfolder/../"
you would need to use Server.MapPath()
VB Code:
Dim PhysicalPath as String = Server.MapPath("../images/files/") Dim di as New System.IO.DirectoryInfo(PhysicalPath) 'Output a list of files Dim Files() as System.IO.FileInfo = di.GetFiles() Response.Write("<b> Files </b><br />") For Each fi as FileInfo In Files Response.Write(fi.Name & "<br />") Next Dim Dirs() as System.IO.DirectoryInfo = Di.GetDirectories() Response.Write("<b> Files </b><br />") For Each d as DirectoryInfo In Dirs Response.Write(d.Name & "<br />") Next
Done of the top of my head, but should work fine....
This lists all the files and then directories (if any exist)
Perfect!
Thanks.