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
- id: C1 claim: shutil offers high-level operations on files and collections of files. source: S1 evidence: "high-level operations on files and collections of files"
- id: C2 claim: copytree recursively copies an entire directory tree. source: S1 evidence: "Recursively copy an entire directory tree"
- id: C3 claim: copy copies the file src to the file or directory dst. source: S2 evidence: "Copies the file src to the file or directory dst"
- id: C4 claim: rmtree deletes an entire directory tree. source: S2 evidence: "Delete an entire directory tree"
Sources
- [S1] shutil — High-level file operations. Python docs. https://docs.python.org/3/library/shutil.html . License: PSF-2.0. Accessed 2026-11-17.
- [S2] shutil.rst (CPython docs). python/cpython (GitHub). https://github.com/python/cpython/blob/main/Doc/library/shutil.rst . License: PSF-2.0. Accessed 2026-11-17.
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
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.},
}
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.