MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / copyfile

Function copyfile

src/commoncode/fileutils.py:437–452  ·  view source on GitHub ↗

Copy src file to dst file preserving timestamps. Ignore permissions and special files. Similar to and derived from Python shutil module. See fileutils.py.ABOUT for details.

(src, dst)

Source from the content-addressed store, hash-verified

435
436
437def copyfile(src, dst):
438 """
439 Copy src file to dst file preserving timestamps.
440 Ignore permissions and special files.
441
442 Similar to and derived from Python shutil module. See fileutils.py.ABOUT
443 for details.
444 """
445 if not filetype.is_regular(src):
446 return
447 if not filetype.is_readable(src):
448 chmod(src, R, recurse=False)
449 if os.path.isdir(dst):
450 dst = os.path.join(dst, os.path.basename(src))
451 shutil.copyfile(src, dst)
452 copytime(src, dst)
453
454
455def copytime(src, dst):

Callers 1

copytreeFunction · 0.85

Calls 3

copytimeFunction · 0.85
chmodFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected