shutil
The standard library module for high-level file operations such as copying, moving and deleting whole folders.
In more detail
shutil.copy copies a file, shutil.copytree a whole folder and shutil.rmtree deletes a folder with everything in it, so use that last one carefully. For single files and paths, pathlib usually reads better.
Related terms
- pathlib — Python's standard library module for working with file paths as objects rather than plain strings.
- os module — The standard library module for talking to the operating system: environment variables, the current directory, files and processes.
Taught in
- A Standard Library Tour — Hands-on Python: Complete Video Course & Book
- When awk Runs Out: Python Data Types, Modules And Virtual Environments For Admins — CompTIA Linux+ (XK0-006) Exam Prep