Check out example codes for "how to trim path in C#". It will help you in understanding the concepts better.

Code Example 1

path=Y:\Test\Project\bin\Debug
ans = String.Join(@"\", path.Split('\\').Skip(3));

Code Example 2

String dir = Path.GetDirectoryName(fullyQualifiedName);
string root = Directory.GetParent(dir).FullName;

Learn ReactJs, React Native from akashmittal.com