Parse directory name from a full filepath in C# November 26, 2023 by Tarik Use: new FileInfo(@"C:\temp\temp2\foo\bar.txt").Directory.Name