diff --git a/CIME/utils.py b/CIME/utils.py index 1e280aa775f..59cbf3c7666 100644 --- a/CIME/utils.py +++ b/CIME/utils.py @@ -1417,13 +1417,18 @@ def safe_copy(src_path, tgt_path, preserve_meta=True): # I am not the owner, just copy file contents shutil.copyfile(src_path, tgt_path) - else: + elif preserve_meta: # We are making a new file, copy file contents, permissions, and metadata. # This can fail if the underlying directory is not writable by current user. shutil.copy2( src_path, tgt_path, ) + else: + shutil.copy( + src_path, + tgt_path, + ) # If src file was executable, then the tgt file should be too st = os.stat(tgt_path)