How can creation times be preserved while copying?

When I copy in Terminal, rsync -t and cp -p only preserve modification times. I am running macOS 11.3.

MacBook Air 13″, macOS 11.3

Posted on Feb 19, 2024 5:52 PM

Reply
2 replies

Feb 19, 2024 6:33 PM in response to jjjefff

Hi jjjefff,


To preserve creation times while copying files in macOS, you can use the `ditto` command in Terminal. Here's how you can do it:


zsh
ditto -V source_directory destination_directory


Replace `source_directory` with the path to the directory you want to copy from and `destination_directory` with the path to the directory you want to copy to.


The `-V` option is optional and enables verbose mode, which provides more detailed output during the copying process.


Using `ditto` preserves not only modification times but also resource forks and other metadata, including creation times, when copying files and directories in macOS.


Alternatively, if you prefer to use `rsync`, you can add the `-X` option to preserve extended attributes and resource forks:


zsh
rsync -avX source_directory/ destination_directory


Again, replace `source_directory` and `destination_directory` with the appropriate paths.


These commands should help you preserve creation times while copying files and directories in macOS.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How can creation times be preserved while copying?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.