Skip to main content
macOS 11.16 has not happened and probably never will.
Source Link
David Anderson
  • 42k
  • 14
  • 67
  • 111

Even simpler!

touch -a -r sourcefile destinationfile

This only changes access time, while my other example changed both access and modification time on the destination. See man touch for details.

Note: on MacOS 11.16, 10.14 (and probably earlier), if the touched file is non-zero length and in a folder indexed by Spotlight, Spotlight will update the access time to the current time soon after the access time is set. Preferences/Spotlight/Privacy can be used to exclude folders from Spotlight indexing.

Note: On macOS 11.6, 10.14 (and probably earlier), if the touched file is non-zero length and in a folder indexed by Spotlight, Spotlight will update the access time to the current time soon after the access time is set. Preferences/Spotlight/Privacy can be used to exclude folders from Spotlight indexing.

Even simpler!

touch -a -r sourcefile destinationfile

This only changes access time, while my other example changed both access and modification time on the destination. See man touch for details.

Note: on MacOS 11.16, 10.14 (and probably earlier), if the touched file is non-zero length and in a folder indexed by Spotlight, Spotlight will update the access time to the current time soon after the access time is set. Preferences/Spotlight/Privacy can be used to exclude folders from Spotlight indexing.

Even simpler!

touch -a -r sourcefile destinationfile

This only changes access time, while my other example changed both access and modification time on the destination. See man touch for details.

Note: On macOS 11.6, 10.14 (and probably earlier), if the touched file is non-zero length and in a folder indexed by Spotlight, Spotlight will update the access time to the current time soon after the access time is set. Preferences/Spotlight/Privacy can be used to exclude folders from Spotlight indexing.

clarification on observed behaviour
Source Link
MichaelR
  • 734
  • 5
  • 11

Even simpler!

touch -a -r sourcefile destinationfile

This only changes access time, while my other example changed both access and modification time on the destination. See man touch for details.

Note: on MacOS 11.16, 10.14 (and probably earlier), if the touched file is non-zero length and in a folder indexed by Spotlight, Spotlight will update the access time to the current time soon after the access time is set. Preferences/Spotlight/Privacy can be used to exclude folders from Spotlight indexing.

Even simpler!

touch -a -r sourcefile destinationfile

This only changes access time, while my other example changed both access and modification time on the destination. See man touch for details.

Even simpler!

touch -a -r sourcefile destinationfile

This only changes access time, while my other example changed both access and modification time on the destination. See man touch for details.

Note: on MacOS 11.16, 10.14 (and probably earlier), if the touched file is non-zero length and in a folder indexed by Spotlight, Spotlight will update the access time to the current time soon after the access time is set. Preferences/Spotlight/Privacy can be used to exclude folders from Spotlight indexing.

Source Link
MichaelR
  • 734
  • 5
  • 11

Even simpler!

touch -a -r sourcefile destinationfile

This only changes access time, while my other example changed both access and modification time on the destination. See man touch for details.