Shutil

Shell Util

  • You can use the function shutil.move() to rename a file:
import shutil
shutil.move("server.log", "server.log.backup") # Rename
shutil.move("image.png", "/home/user/") # Move
shutil.copy() #to copy a file: