Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Doc/library/shutil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ Directory and files operations
as arguments. By default, :func:`shutil.copy2` is used, but any function
that supports the same signature (like :func:`shutil.copy`) can be used.

.. versionchanged:: 3.8
Accepts a :term:`path-like object` for *src* and *dst*.

.. versionchanged:: 3.3
Copy metadata when *symlinks* is false.
Now returns *dst*.
Expand Down
3 changes: 3 additions & 0 deletions Lib/shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ def copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2,
function that supports the same signature (like copy()) can be used.

"""
src = os.fspath(src)
dst = os.fspath(dst)

names = os.listdir(src)
if ignore is not None:
ignored_names = ignore(src, names)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support Path-like in shutil.copytree