`normpath` does more than simply removing the trailing slash. If I understood the docs correctly, it changes `/A/B/../C/` to `/A/C` by looking at the string only. If `B` is a symlink, this may give the wrong path. `realpath` appears to resolve symlinks correctly, but that removes any symlinks I might have (which makes it impossible to mirror the directories locally but store the files on external disks, for example).

I’m aware that the code above uses `normpath`-magic. I have no idea why `os.path.samefile` is only available on unix, otherwise I’d suggest switching to it.