>"I have discovered the hard way that Apple's "Migration Assistant" doesn't always preserve file timestamps" 

<sup>*Comment*: It seems that has become Apple's [MO](https://www.merriam-webster.com/dictionary/modus%20operandi) - you must discover all things the *"hard way"*.</sup> 

*Caveats:* I don't actually know what `Migration Assistant` does as I've never used it. However, based on the `rsync` example below, I've shown **it will** preserve your timestamps (and other metadata you may have lost). 

I used `rsync` ver 3.2.4 for this answer, installed from [MacPorts](https://www.macports.org). I can't guess what features your version of `rsync` includes. You should consider upgrading `rsync` with MacPorts or Homebrew. [Apple hasn't upgraded "their" version of `rsync` in many years](https://apple.stackexchange.com/a/444906/149366), and it lacks the ability to support the methods and options used here. 

*Background:* I began using `rsync` as my primary backup tool for macOS some time ago because I had to address the same issues as you: mangled and missing [*metadata*](https://en.wikipedia.org/wiki/File_system#Metadata). In my case, the issue was perhaps exacerbated by **crossing a file system boundary** - from `APFS` on my local drive to `btrfs` via SMB on a 'Synology NAS'. In your case, using `Migration Assistant`, I cannot imagine how Apple could not get the timestamp metadata correct - but you're not the only one who's reported this issue.

I made some notes while working to resolve my issue, and they morphed into a *"recipe"* in this [GitHub repo](https://github.com/seamusdemora/seamusdemora.github.io/blob/master/RsyncWithNoMetaDataLoss.md). I'll keep this answer brief as most of the details are covered in that document. 

---

## Q: Can I use rsync to fix the timestamps that Migration Assistant trashed? 
## A: Yes - as shown below and verified

## `rsync` with metadata preservation

`rsync` effectively copies data from a **source** (the *"from"* location) to a **destination** (the *"to"* location). If you are using a fileserver (NAS) as a backup for your Mac, the [GitHub recipe](https://github.com/seamusdemora/seamusdemora.github.io/blob/master/RsyncWithNoMetaDataLoss.md) will provide complete guidance to make and restore an `rsync` backup without losing metadata (`attr`s & `xattr`s). 

However, as you need only to *"migrate"* files & folders from an old Mac to a new Mac, there is no need to involve an intermediate NAS. Consequently, the *GitHub recipe* can be simplified. 

The scenario below assumes that the remote folders have been mounted (perhaps via *'File Sharing'* in *'System Settings'*). Alternatively, if you prefer to enable *'Remote Login'* you can run `rsync` via `SSH`. 

The following command `code block` shows the command syntax & options needed for `rsync` to perform an *old Mac-to-new Mac* *"migration"*: 

### SCENARIO: from "oldMac" to "newMac" 

Assuming the source & destination folders are:  
   **SOURCE:** `/Users/MyHome/oldMacFolder/`  
   **DESTINATION:** `/Users/MyHome/newMacFolder`  

***From `Terminal.app` on your "old Mac":***

```zsh
% SRC-FLDR="/Users/MyHome/oldMacFolder/"
% DST-FLDR="/Users/MyHome/newMacFolder"
% rsync -rlAXtgoDivv --dry-run -M--fake-super $SRC-FLDR $DST-FLDR
```

***Notes:***
   1. `--dry-run` this option prevents `rsync` from actually copying any files! It's used so that you can see what will be copied once the option is removed. 

   2. If you've not set up file-sharing to mount the remote folder(s), you may use an `SSH` connection by adding the option `-e ssh` to the `rsync` command. This will require that you've set up *'Remote Login'* in *'System Settings'*.

### Verifying Results - Preservation of All Metadata: 

The [GitHub recipe](https://github.com/seamusdemora/seamusdemora.github.io/blob/master/RsyncWithNoMetaDataLoss.md) includes a short `zsh` [script that will `stat` all of the files, folders, links, etc between the SOURCE and DESTINATION folders](https://github.com/seamusdemora/seamusdemora.github.io/blob/master/src/get-stats.sh). It may be run after the `rsync` operations to verify that the chosen `stat` attributes have been preserved. 

The `rsync` options presented here will do more than preserve the metadata containing the date-time stamps; they will also preserve all **extended attributes** (`xattr`s) . The GitHub recipe also includes a simple [script to compare the output of `xattr -lrsvx` for all files (that have `xattrs`) in the SOURCE and DESTINATION directories](https://github.com/seamusdemora/seamusdemora.github.io/blob/master/src/get-xattrs.sh). 

The `stat` utility that I use here is the *GNU coreutils version 9.1*. The `find` version I use is the *GNU findutils version 4.9.0*. Both are readily available through [MacPorts](https://www.macports.org/) (and likely through Homebrew) for virtually every version of macOS. The `xattr` command is a macOS utility. 

---

### References and Further Reading: 

1. [There’s more to files than data: Extended Attributes](https://eclecticlight.co/2020/10/24/theres-more-to-files-than-data-extended-attributes/)  

2. [From quarantine to provenance: extended attributes](https://eclecticlight.co/2024/09/12/from-quarantine-to-provenance-extended-attributes/) 

3. [From quarantine to provenance: how xattrs are copied](https://eclecticlight.co/2024/09/13/from-quarantine-to-provenance-how-xattrs-are-copied/) 

4. [Extended attributes](https://wiki.archlinux.org/title/Extended_attributes#Preserving_extended_attributes) 

5. [How to use rsync over ssh](https://linuxconfig.org/using-rsync-over-ssh-an-ultimate-backup-tool)