← All notes

shutil provides high-level operations for copying, moving, and removing files

Answer: shutil offers high-level operations on files and on collections of files. Functions support file copying and removal. For operations on an individual file, see also the os module. Even shutil.copy and shutil.copy2 cannot copy all file metadata.

copy, copytree, and rmtree

shutil.copy copies the file src to the file or directory dst. It copies file data and the permission mode, but not creation or modification times. Use shutil.copy2 when you want to preserve more metadata.

shutil.copytree recursively copies an entire directory tree rooted at src to a directory named dst. shutil.rmtree deletes an entire directory tree. shutil.move recursively moves a file or directory to another location.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python docs, shutil — High-level file operations, PSF-2.0 (https://docs.python.org/3/license.html); python/cpython (GitHub), shutil.rst (CPython docs), PSF-2.0 (https://raw.githubusercontent.com/python/cpython/main/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Python docs, shutil — High-level file operations, PSF-2.0 (https://docs.python.org/3/license.html); python/cpython (GitHub), shutil.rst (CPython docs), PSF-2.0 (https://raw.githubusercontent.com/python/cpython/main/LICENSE).

Cite this

Permanent ID: iil:note:970se3r7

iinventedlight. 2026. "shutil provides high-level operations for copying, moving, and removing files." iinventedlight Library, iil:note:970se3r7, version of 2026-11-17. https://iinventedlight.com/library/notes/python-shutil/. License: CC-BY-4.0.

@misc{iil_note_970se3r7,
  author = {{iinventedlight}},
  title = {{shutil provides high-level operations for copying, moving, and removing files}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-17},
  url = {https://iinventedlight.com/library/notes/python-shutil/},
  note = {Permanent ID iil:note:970se3r7. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-shutil.md.