string pathToFile = @"D:\Temp\Myfile.txt"; string justTheFileName = Path.GetFileNameWithoutExtension(pathToFile); // MyFile string justTheFileNameWithExtension = Path.GetFileName(pathToFile); // MyFile.txt string justTheExtension = Path.GetExtension(pathToFile); // .txt string justThefolderItsIn = Path.GetDirectoryName(pathToFile); // D:\Temp
String path=@"C:\Program Files\Test.txt"; MessageBox.Show(Path.GetFileName(path));
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)