I am trying to determine if one path is a child of another path.
I already tried with:
if (Path.GetFullPath(A).StartsWith(Path.GetFullPath(B)) ||
Path.GetFullPath(B).StartsWith(Path.GetFullPath(A)))
{ /* ... do your magic ... */ }
like in How to check if one path is a child of another path? post
But it doesn't work. For example if I write "C:\files" and "C:\files baaa" the code thinks that the "C:\files baaa" is a child of "C:\files", when it isn't, it is only of C:. The problem is really heavy when I try with long paths, with an amount of childs.
I also tried with "if contains \"... but still not really working in all the chases
What can I do?
Thanks!