I think shutil has for a very long time been the preferred way to copy or move files is Python.
My answers 10-years ago(i have looked) would pretty much be the same today.
Could add pathlib to be more modern.
My answers 10-years ago(i have looked) would pretty much be the same today.
Could add pathlib to be more modern.
from pathlib import Path from shutil import copy, move source = Path('old_file.txt') destination = Path('new_file.txt') copy(source, destination) # move(source, destination)