How to copy files preserving attributes/dates
$ cp -p [source] [dest]
- Command
- cp
- Description
- Copy files while preserving their modification time, access time, and permissions. Usage: cp -p [source] [dest].
- Deep Dive
- By default, 'cp' updates the timestamp to the current time and changes ownership to the current user. Use -p (preserve) to keep them unchanged. For full backups, consider `-a` (archive), which implies `-p` and `-r`.
- Related
- How to copy a directory a