4

I need to copy files and preserve all their metadata, including creation date.

I found ways to use rsync options to preserve modification date, but I also need the creation date to be the same, and not depending on when I copy the files.

Is there a way to do so? With a utility or any other way?

Maybe I could do it programmatically?

2
  • 1
    Brith/creation time like change-status time on Linux is not meant to be tampered with. But then again, see Change file creation date and time based off of file name for a way to trick your system. Oct 3, 2022 at 13:10
  • Also beware that that birth time is rarely useful as it doesn't tell you when the contents of the file was created nor even when a file with that name appeared in a directory. Oct 3, 2022 at 13:14

1 Answer 1

4

If your destination filesystem supports creation (birth) time metadata, using an rsync version (3.1.1 or later) that supports the crtimes option achieves what you want.

--crtimes, -N

This tells rsync to set the create times (newness) of the destination files to the same value as the source files.

Update:

While this works flawlessly on macOS, with Linux this isn't supported. See here.

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .