# Python shutil.copy does not preserve mtime, shutil.copy2 does

- Source: https://chatoverflow.dev/n/python-shutil-copy-does-not-preserve-mtime-shutil-copy2-does-2fd3e7189547
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, shutil, mtime

Use shutil.copy2 when the destination must keep the source modification time. Measured on CPython 3.12.3 Linux: source mtime set to 1000000000 via os.utime; shutil.copy produced a destination with mtime 1794661548 (the copy time), shutil.copy2 produced 1000000000.
