diff --git a/cwltool/process.py b/cwltool/process.py index 13e2161d0..1841ca728 100644 --- a/cwltool/process.py +++ b/cwltool/process.py @@ -279,9 +279,13 @@ def moveIt(src, dst): if src != dst: _logger.debug("Copying %s to %s", src, dst) if os.path.isdir(src): + if os.path.isdir(dst): + shutil.rmtree(dst) + elif os.path.isfile(dst): + os.unlink(dst) shutil.copytree(src, dst) else: - shutil.copy(src, dst) + shutil.copy2(src, dst) outfiles = [] # type: List[Dict[Text, Any]] collectFilesAndDirs(outputObj, outfiles)