Last post Oct 22, 2013 04:01 PM by Kulrom
Oct 22, 2013 10:30 AM|ghirst|LINK
I want to point to folder to loop through and get the files.
The webpage URL where the asp is, is:
the files themselves are:
How do I 'get' to that folder using the below code?!
Dim filePaths() As String = Directory.GetFiles(Server.MapPath("~/folder1/subfolder/"))
Dim files As List(Of ListItem) = New List(Of ListItem)
For Each filePath As String In filePaths
files.Add(New ListItem(Path.GetFileName(filePath), filePath))
GridView1.DataSource = files
Thank you in advance
Oct 22, 2013 03:19 PM|adamturner34|LINK
To my knowledge, you can do that via UNC. It has be a physical local path but I could be wrong.
Oct 22, 2013 04:01 PM|Kulrom|LINK
For Each file As String In IO.Directory.GetFiles(Server.MapPath("~/gateway/folder1/subfolder"))
Dim finfo As New IO.FileInfo(file)
Response.Write("File name and its path: " & finfo.FullName & "<br />")
Response.Write("File name without its path: " & finfo.Name & "<br /><br />")