I have the following full path:
D:\Test1\Test1_1\Test2_1\Test3_1\Test4_1
If I call
Path.GetFileName(abovePath) will return Test4_1
Well.
I want to get Test2_1\Test3_1, for example.
How to do that with Path class if is possible ? If not, how to proceed ?
I want a generic example, do not focus only my given full path.
Thank you.
Use DirectoryInfo and Parent, e.g.
Note you would want null checks on these but that’s the general idea