Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 2
    But touch modifies the modified date, not the creation date of the file. Commented Aug 21, 2013 at 14:35
  • 1
    It can do both. Depends on the parameters. Commented Aug 21, 2013 at 14:39
  • 3
    Using touch with the parameters you gave above changed the modification but not creation dates for my test file. Commented Aug 21, 2013 at 14:50
  • 2
    @Daniel You probablly got your answer, but for completeness sakes touch does modify the creation date depending on the arguments. If you supply a modification date that is before the file's creation date, the creation date will automatically change to the new modification date value, as a file cannot be modified before it is created. Commented Nov 9, 2016 at 7:25
  • 5
    I just tried this on Sierra and touch definitely does not change the creation date. I was able to change access and modified dates to a "date in the past", but it did not modify creation date. Check the man page for touch, it does not mention creation date. File system : Mac OS Extended (Journaled, Encrypted). Using SetFile -d "$(GetFileInfo -m test.txt)" file.txt worked perfectly. Commented Jan 16, 2018 at 16:48