Search notes:

Python standard library: shutil

The Python standard library shutil contains high-level file operations.

copyfile

import shutil

shutil.copyfile('script.py', 'script.py.copied')
Github repository about-python, path: /standard-library/shutil/script.py

rmtree

An interesting function that is found in shutil is rmtree that can be used to remove entire entire directory trees.
Compare this function with those that are found in the os library.

unpack_archive

import shutil
shutil.unpack_archive('data.zip', '.')
zip files that use compression type 9 (Deflate64/Enhanced Deflate), a proprietary PKWare format, cannot be expanded with shutil (or the zip module), and throws a NotImplementedError: That compression method is not supported exception.
This is not the case with the more common compression type 8.

See also

standard library

Index