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)
| 435 | |
| 436 | |
| 437 | def 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 | |
| 455 | def copytime(src, dst): |