If Path actually contains double slashes (which usually doesn’t happen):
-
Replace
\\
with\
inpath1
-
Replace
path1
withEmpty String
inpath2
string diff = path2.Replace(path1.Replace(@"\\", @"\"), "");
Otherwise:
string diff = path2.Replace(path1, "");
9
solved Get Difference of 2 Paths [duplicate]