Message 146282 - Python tracker (original) (raw)

"The solution? Let's remember that metadata changes are atomic. Rename is such a case."

Hmmm. Is he referring to the "standard" rename? The blog doesn't evoke a specific function, but if it was the case, then why bother at all?

Standard rename (MoveFile) fails when the target exists, and that's AFAICT the whole problem with it. MoveFileEx allows to overwrite the target with MOVEFILE_REPLACE_EXISTING.

By the way: """

There's exactly the same limitation with the POSIX version (except that it'll fail with EXDEV instead of silently doing the copy+unlink).

If you don't specify the MOVEFILE_COPY_ALLOWED flag, MoveFileEx also fails. I don't understand what Victor was trying to say.