os independent rename

Nobody nobody at nowhere.com
Sat Sep 17 15:18:19 EDT 2011

On Sat, 17 Sep 2011 20:28:32 +0430, Lee Harr wrote:

> So, what is the best way to do this that will
> behave the same across operating systems?

Delete the destination first, but after checking that it isn't the same as
the source.

On Windows, that last bit is harder than it seems. A string-based
comparison won't work. Even if you ignore case, there's the issue of 8.3
filenames, and some other odd cases.

More information about the Python-list mailing list