import os import shutil os.rename("current_path/foo.bar", "new_path/foo.bar") shutil.move("current_path/foo.bar", "new_path/foo.bar") os.replace("current_path/foo.bar", "new_path/foo.bar")
import os import shutil os.rename("path/to/current/file.foo", "path/to/new/destination/for/file.foo") shutil.move("path/to/current/file.foo", "path/to/new/destination/for/file.foo") os.replace("path/to/current/file.foo", "path/to/new/destination/for/file.foo")