CIME.utils.copy_over_file

CIME.utils.copy_over_file(src_path, tgt_path, preserve_meta=True)[source]

Copy a file over a file that already exists.

preserve_meta controls whether file metadata (permissions, timestamps) are copied from src_path. When True and the caller owns the target, shutil.copy2 is used (contents + metadata). When False and the caller owns the target, the contents are written to a fresh temp file (so the caller’s umask takes effect) which is then renamed atomically over the target. In either case, a read-only owned target is made writable before the copy.