Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get only directory name from SaveFileDialog.FileName

Tags:

string

c#

parsing

What would be the easiest way to separate the directory name from the file name when dealing with SaveFileDialog.FileName in C#?

like image 484
Redbaron Avatar asked Aug 19 '08 14:08

Redbaron


1 Answers

Use:

System.IO.Path.GetDirectoryName(saveDialog.FileName)

(and the corresponding System.IO.Path.GetFileName). The Path class is really rather useful.

like image 142
Adam Wright Avatar answered Oct 10 '22 21:10

Adam Wright