python - How to move a file? - Stack Overflow

PHOTO EMBED

Wed Mar 31 2021 16:46:29 GMT+0000 (Coordinated Universal Time)

Saved by @arielvol

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")
content_copyCOPY

https://stackoverflow.com/questions/8858008/how-to-move-a-file