Title: Add copy_directory_metadata parameter to shutil.copytree
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: desbma, giampaolo.rodola
Priority: normal Keywords: patch

Created on 2017-11-18 19:13 by desbma, last changed 2018-06-12 09:41 by giampaolo.rodola.

Pull Requests
URL Status Linked Edit
PR 4456 open desbma, 2017-11-18 19:27
Messages (2)
msg306494 - (view) Author: desbma (desbma) * Date: 2017-11-18 19:13
I am sometimes using shutil.copytree to copy a directory to a destination that does not support setting metadata (like MTP mounts of Android devices).

Using the copy_function parameter allows passing shutil.copy or a custom function to ignore file metadata, however currently shutil.copytree always tries to call copystat on directories, which can fail with OSError (errno set to ENOTSUPP).

The code assumes copystat can fail on Windows, but propagates the error on other OS, even though the tree copy actually succeeds.
msg308628 - (view) Author: desbma (desbma) * Date: 2017-12-19 11:49
Date User Action Args
2018-06-12 09:41:30giampaolo.rodolasetnosy: + giampaolo.rodola
2017-12-19 11:49:25desbmasetmessages: + msg308628
2017-11-18 19:27:13desbmasetkeywords: + patch
stage: patch review
pull_requests: + pull_request4394
2017-11-18 19:13:27desbmacreate