Hi Everyone,
I have a quick question about some usage. I need to return the base path of this class, in C#, meaning, when I call:
Code Snippet
string[] dirs = Directory.GetDirectories(Server.MapPath("../users/"));
foreach(string dir in dirs) {
Response.Write("\n" + dir);
I don't want C:\asdf1\asdf2\asdf3. I just want asdf3
In VB, I would call:
Dim fs
fs=Server.CreateObject("Scripting.FileSystemObject")
'-- Get directory listing into an array
FolderArray = Directory.GetDirectories(Server.MapPath("../users/"))
'-- Iterate the array items and display directories
For Each Item in FolderArray
response.Write("<a href=""" & fs.GetBaseName(Item) & """>" & fs.GetBaseName(Item) & "</a> </br>")
Next
and it would give me the base name and then link me to the full server path. I'm using this to driver further down in directories, so if it is at all possible to keep what I'm doing in c# intact, that would be greatly appreciated. Thank you