copytree module

class CopyTree(src, dst, symlinks=False, ignore=None, copy_function=<function copy2>)[source][source]

Bases: object

Rewrite shutil.copytree().

Parameters
  • src (str (path-like)) – Directory tree to copy.

  • dest (str (path-like)) – Directory to move tree to.

  • symlinks (Bool, optional) – Whether to follow symlinks. Defaults to False.

  • ignore (glob.glob() pattern) – Files to not copy.

  • copy_function (shutil copy function, optional) – Defaults to shutil.copy2().

Returns

dst – TODO

Return type

TODO type

Notes

Copying file access times may fail on Windows and if so ignore it.

errors = [][source]
__init__(src, dst, symlinks=False, ignore=None, copy_function=<function copy2>)[source][source]
property destination_files[source][source]
make_dest_dirs()[source][source]

Create the dirs needed in the destination.

copytree()[source][source]

Let’s try and do shutil.copytree() a little better.

First let’s do everyone the courtesy of checking whether src and dest are pathlib.Path objects.