I have 2 strings – dir1 and dir2, and I need to check if one is sub-directory for other. I tried to go with Contains method:
dir1.contains(dir2);
but that also returns true, if directories have similar names, for example – c:\abc and c:\abc1 are not sub-directories, bet returns true. There must be a better way.
Or in a loop to allow for nested sub-directories, i.e. C:\foo\bar\baz is a sub directory of C:\foo :