Click to See Complete Forum and Search --> : Virtual folder
BarankinBeAMan
May 18th, 2005, 06:17 PM
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!!
Phenglai
May 20th, 2005, 04:49 PM
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.
BarankinBeAMan
May 20th, 2005, 07:55 PM
how does that work in virtual directory?? "../folder/subfolder/../"
<ABX
May 20th, 2005, 09:50 PM
you would need to use Server.MapPath()
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)
BarankinBeAMan
May 21st, 2005, 08:26 AM
Perfect!
Thanks.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.