Skip to content

Commit 8ea90c0

Browse files
jasper1918tetron
authored andcommitted
remove dir before copytree, use copy2 to keep metadata (#545)
* remove dir or file before copytree, use copy2 to keep metadata
1 parent 77a3528 commit 8ea90c0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cwltool/process.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,13 @@ def moveIt(src, dst):
279279
if src != dst:
280280
_logger.debug("Copying %s to %s", src, dst)
281281
if os.path.isdir(src):
282+
if os.path.isdir(dst):
283+
shutil.rmtree(dst)
284+
elif os.path.isfile(dst):
285+
os.unlink(dst)
282286
shutil.copytree(src, dst)
283287
else:
284-
shutil.copy(src, dst)
288+
shutil.copy2(src, dst)
285289

286290
outfiles = [] # type: List[Dict[Text, Any]]
287291
collectFilesAndDirs(outputObj, outfiles)

0 commit comments

Comments
 (0)