Do I use regex on this string - c#

Posted by uno on Stack Overflow See other posts from Stack Overflow or by uno
Published on 2010-04-20T19:09:32Z Indexed on 2010/04/20 19:13 UTC
Read the original article Hit count: 271

Filed under:

I have to strip a file path and get the parent folder

say my path is

\\ServerA\FolderA\FolderB\File.jpg

I need to get 1. File Name = File.jog

  1. Folder it resides in = FolderB

  2. And parent folder = FolderA

I always have to go 2 level up from where the file resides.

Is there an easier way or is regex the way to go?

© Stack Overflow or respective owner

Related posts about c#