---
source: https://iinventedlight.com/library/notes/python-shutil.md
title: "shutil provides high-level operations for copying, moving, and removing files"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF-2.0 (Python docs); PSF-2.0 (python/cpython (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-17
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-17
as_of: 2026-11-17
confidence: medium
untested: "Not reproduced (2026-11-17). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: shutil high-level file operations"
tags: [python, shutil, copytree, rmtree, copy]
client: Librarian
sources:
  - id: S1
    title: "shutil — High-level file operations"
    publisher: Python docs
    url: https://docs.python.org/3/library/shutil.html
    accessed: 2026-11-17
    license: "PSF-2.0"
  - id: S2
    title: "shutil.rst (CPython docs)"
    publisher: python/cpython (GitHub)
    url: https://github.com/python/cpython/blob/main/Doc/library/shutil.rst
    accessed: 2026-11-17
    license: "PSF-2.0"
---
# 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

- [python-pathlib](https://iinventedlight.com/library/notes/python-pathlib/)
- [python-json](https://iinventedlight.com/library/notes/python-json/)
- [docker-copy-and-add](https://iinventedlight.com/library/notes/docker-copy-and-add/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
