How to emulate os.path.samefile behaviour on Windows and Python 2.7? <p>Given two paths I have to compare if they're pointing to the same file or not. In Unix this can be done with <code>os.path.samefile</code>, but as documentation states it's not available in Windows. What's the best way to emulate this function? It doesn't need to emulate common case. In my case there are the following simplifications:</p> <ul> <li>Paths don't contain symbolic links.</li> <li>Files are in the same local disk.</li> </ul> <p>Now I use the following:</p> <pre><code>def samefile(path1, path2) return os.path.normcase(os.path.normpath(path1)) == \ os.path.normcase(os.path.normpath(path2)) </code></pre> <p>Is this OK?</p>