Although os.rename()
and shutil.move()
will both rename files, the command that is closest to the Unix mv command is shutil.move()
. The difference is that os.rename()
doesn't work if the source and destination are on different disks, while shutil.move()
doesn't care what disk the files are on.