C# trim directory name to filename code example
Example 1: how to trim path in C#
String dir = Path.GetDirectoryName(fullyQualifiedName);
string root = Directory.GetParent(dir).FullName;
Example 2: how to trim path in C#
path=Y:\Test\Project\bin\Debug
ans = String.Join(@"\", path.Split('\\').Skip(3));