Show all Folder (Directory) name in Project using C# and VB.Net

nauna
 
on Dec 17, 2022 01:19 AM
473 Views

hello,

I want to show all the folder name i have in my project on the page.

please advice.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Dec 17, 2022 01:21 AM
on Dec 18, 2022 09:46 PM

Hi nauna,

Use DirectoryInfo class.

C#

System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(Server.MapPath("~/"));
System.IO.DirectoryInfo[] folders = info.GetDirectories();

VB.Net

Dim info As System.IO.DirectoryInfo = New System.IO.DirectoryInfo(Server.MapPath("~/"))
Dim folders As System.IO.DirectoryInfo() = info.GetDirectories()