c# path get filename without extension code example
Example 1: c# fileinfo filename without extension
DirectoryInfo dir = new DirectoryInfo(path);
FileInfo[] files = dir.GetFiles("*.txt");
foreach (FileInfo file in files)
{
string noExtension = Path.GetFileNameWithoutExtension(file.Name);
}
Example 2: c# get path without filename
var fn = openFileDialogSapTable.FileName;
var currentPath = Path.GetFullPath( fn );
currentPath = Directory.GetParent(currentPath).FullName;