static void Main(string[] args) { string filePath = @"e:\test\abc.jpg"; Console.WriteLine(Path.GetFullPath(filePath)); //--> E:\test\abc.jpg Console.WriteLine(Path.GetDirectoryName(filePath)); //--> E:\test Console.WriteLine(Path.GetFileName(filePath)); //--> abc.jpg Console.WriteLine(Path.GetFileNameWithoutExtension(filePath)); //--> abc Console.WriteLine(Path.GetExtension(filePath)); //--> .jpg Console.WriteLine(Path.GetPathRoot(filePath)); //--> E:\ Thread.Sleep(3000); }