shutil

noun

say it: “SHUH-til” /ˈʃʌtɪl/

Python's built-in module, short for shell utilities, for copying, moving and removing files and whole folders.

What is shutil?

shutil (read "shell utilities") is Python's standard module for copying and moving files and folders, such as shutil.copy2 to copy a file with its dates and shutil.move to move or rename one.

import shutil
shutil.copy2("report.pdf", "backup/report.pdf")   # a copy, dates kept
shutil.move("photo.jpg", "Pictures/photo.jpg")    # moved

In a sentence

  • “The sorter calls shutil.move to put each photo in Pictures.”
  • “She used shutil to copy the whole project folder before cleaning it up.”

Level: Journeyman · More Python terms at this level

Updated