From 8c738425ada0982be02e53bf4556a9a575b339eb Mon Sep 17 00:00:00 2001 From: Gijs Molenaar Date: Thu, 30 Mar 2017 10:12:57 +0200 Subject: [PATCH] Recursive copy --- cwltool/process.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cwltool/process.py b/cwltool/process.py index 371eebbdb..3a8117349 100644 --- a/cwltool/process.py +++ b/cwltool/process.py @@ -236,7 +236,15 @@ def moveIt(src, dst): return if src != dst: _logger.debug("Copying %s to %s", src, dst) - shutil.copy(src, dst) + try: + # first try a tree copy + shutil.copytree(src, dst) + except OSError as exc: + # check for exception is faster + if exc.errno == errno.ENOTDIR: + # if no dir copy file + shutil.copy(src, dst) + else: raise outfiles = [] # type: List[Dict[Text, Any]] collectFilesAndDirs(outputObj, outfiles)