Is python's shutil.move() atomic on linux? Is python's shutil.move() atomic on linux? unix unix

Is python's shutil.move() atomic on linux?


It is not atomic if the files are on different filsystems. In that case, python opens the source and destination file, loops on reading from the source and writing to the desination and finally unlinks the source file.

If the source and destination file are on the same file system, python uses the rename() C call, which is atomic.