How to test if two strings point to the same file or directory?

Tim Golden tjgolden at gmail.com
Sun Dec 17 05:04:26 EST 2006


Sandra-24 wrote:
> Comparing file system paths as strings is very brittle. Is there a
> better way to test if two paths point to the same file or directory
> (and that will work across platforms?)

I suspect that the "and that will work across platforms"
parenthesis is in effect a killer. However, if you're
prepared to waive that particular requirement, I can
suggest reading this page for a Win32 possibility:

http://timgolden.me.uk/python/win32_how_do_i/see_if_two_files_are_the_same_file.html

TJG




More information about the Python-list mailing list