0

first of all sorry about my english. I need to split a file path. For example:

"C:\Folder\Folder2\1.cr2"

I need to get file drive, file path, file name and file extension separately:

C:\ , 
Folder\Folder2 ,
1 and 
.cr2

Thanks.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Leandro
  • 870
  • 2
  • 13
  • 27
  • 4
    Any effort so far? You can easily find file name, extension name and root folder using `Path` class. Just use Google. – Soner Gönül Oct 23 '14 at 13:40
  • What searches have you done? This is pretty simple stuff. [Path.GetPathRoot(string)](http://msdn.microsoft.com/en-us/library/system.io.path.getpathroot(v=vs.110).aspx). [Path.GetExtension(string)](http://msdn.microsoft.com/en-us/library/system.io.path.getextension(v=vs.110).aspx) – sab669 Oct 23 '14 at 13:40
  • My problem is to find first and second. The FileName and FileExtension is not a problem. I can't find how I can split C:\ and the path without the filedrive – Leandro Oct 23 '14 at 13:42
  • @user3284892 You can find `C:` with `GetPath`, you can find `1.cr2` with `GetFileName`, remove this strings from your original string. TA...TA...TAAAA, you have now `Folder\Folder2` (might need to remove some \ as well). – Soner Gönül Oct 23 '14 at 13:45
  • Show us something. Your code. Effort please. – jayvee Oct 23 '14 at 13:45
  • @user3284892 . Thats what I was missing. Remove the information from the original string. I'm so dumb. Thanks. – Leandro Oct 23 '14 at 14:01

0 Answers0