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

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -