Find a part of UNC path and put in a variable?

Posted by Refracted Paladin on Stack Overflow See other posts from Stack Overflow or by Refracted Paladin
Published on 2010-05-03T13:26:48Z Indexed on 2010/05/03 13:38 UTC
Read the original article Hit count: 236

Filed under:
|
|
|

I am trying to peel off the last part of a unc path that is being passed and put it in a variable to use in a method further down the line.

Example path would be --> \\ourfileserver\remoteuploads\countyfoldername\personfoldername

How do I peel just the countyfoldername out of that?

I had thought to try

var th = e.FullPath.LastIndexOf('\\');
        var whichFolder = folderPath.Substring(th);

but that is an escape character and it doesn't like @ either.

Is this even the right direction?

© Stack Overflow or respective owner

Related posts about c#

Related posts about string-manipulation