I want to move a file form one directory to another in linux with python. I wish to achieve a behavior similar to bash mv
command.
What is the difference in practice between the two commands
os.replace()
os.rename()
Is it simply that os.rename()
will raise an error if file exists in destination while os.replace()
will overwrite it?
Also if another secondary difference that I see it that the os.replace()
needs a file as a destination not just the directory.
I can find a direct answer anywhere.