dirpath:=proc(a,b,c) local dirtemp,dirnew,x; use StringTools in dirtemp:=LongestCommonSubString(c, LongestCommonSubString(a,b)); x:=FirstFromRight("/",dirtemp); dirnew:=dirtemp[1..x]; return dirnew; end use; end proc;