I've been using
os.rename to move files in Python. However, it appears that this fails if you try to move files between one mountpoint and another (on Linux).
Is there a Python library or function to move files between mountpoints, similar to
mv on Linux?
This is a common caveat with
os.rename. The higher level
shutil module and it's
move method works around this for you by using
shutil.copy2() as appropriate.
One thing to keep in mind is that this loses the atomic guarantee that
os.rename has if it isn't on the same filesystem.
You can use
mv using subprocess
from subprocess import check_call check_call(["mv","src","dest"])