[Solved] Get Difference of 2 Paths [duplicate]


If Path actually contains double slashes (which usually doesn’t happen):

  1. Replace \\ with \ in path1

  2. Replace path1 with Empty String in path2

    string diff = path2.Replace(path1.Replace(@"\\", @"\"), "");
    

Otherwise:

string diff = path2.Replace(path1, "");

9

solved Get Difference of 2 Paths [duplicate]