string - C# How do I extract each folder name from a path? -



string - C# How do I extract each folder name from a path? -

my path "\server\foldername1\another name\something\another folder\"

how extract each folder name string if don't know how many folders there in path , don't know folder names?

many thanks

string mypath = @"..\folder1\folder2\folder2"; string[] directories = mypath.split(path.directoryseparatorchar);

edit: returns each individual folder in directories array. can number of folders returned this:

int foldercount = directories.length;

c# string

Comments

Popular posts from this blog

php - How to pass multiple values from url -

php - Laravel not returning controller -

c# - Confused on how to specify a Platform and Version while using ChromeOptions for RemoteWebDriver with Selenium donNet since recent updates -