public static void Main()
Func<string, string, string> p=(f,t)=>f==t?".":new Uri("/"+t).MakeRelativeUri(new Uri("/"+f))+"";
Console.WriteLine(p("/home/user/mydir/myfile", "/home/user/"));
Console.WriteLine(p("/home/user/", "/home/user/"));
Console.WriteLine(p("/dir1/dir2/dir3/dir4", "/dir1/dir2/"));
Console.WriteLine(p("/home/user/myfile", "/tmp/someplace"));
Console.WriteLine(p("/var/users/admin/secret/passwd/", "/var/users/joe/hack/"));