Copy data and metadata. Return the file's destination. Metadata is copied with copystat(). Please see the copystat function for more information. The destination may be a directory. If follow_symlinks is false, symlinks won't be followed. This resembles GNU's "cp -P sr
(src, dst, *, follow_symlinks=True)
| 433 | return dst |
| 434 | |
| 435 | def copy2(src, dst, *, follow_symlinks=True): |
| 436 | """Copy data and metadata. Return the file's destination. |
| 437 | |
| 438 | Metadata is copied with copystat(). Please see the copystat function |
| 439 | for more information. |
| 440 | |
| 441 | The destination may be a directory. |
| 442 | |
| 443 | If follow_symlinks is false, symlinks won't be followed. This |
| 444 | resembles GNU's "cp -P src dst". |
| 445 | """ |
| 446 | if os.path.isdir(dst): |
| 447 | dst = os.path.join(dst, os.path.basename(src)) |
| 448 | copyfile(src, dst, follow_symlinks=follow_symlinks) |
| 449 | copystat(src, dst, follow_symlinks=follow_symlinks) |
| 450 | return dst |
| 451 | |
| 452 | def ignore_patterns(*patterns): |
| 453 | """Function that can be used as copytree() ignore parameter. |