How to change the creation date of a file in OS X

If you need to change the “date modified” and “date created” attributes of some file. In OS X can be easily done using the Unix console.

Change date created

For changing the creation date just use use the command touch -t followed by the date and the path of the file. The date has the following format [[CC]YY]MMDDhhmm[.SS]]:

  • CC The first two digits of the year (the century).
  • YY The second two digits of the year.
  • MM The month of the year, from 01 to 12.
  • DD the day of the month, from 01 to 31.
  • hh The hour of the day, from 00 to 23.
  • mm The minute of the hour, from 00 to 59

For example for changing the creation date of the file test.doc to 16:15 11st of December 2012:

touch -t 201212211615 /path_to_the_file/test.doc

Note that this will change both “date modified” and “date created” attributes.

Change date modified

Changing the “date modified” attribute is similar to the previous step, but just using touch -mt instead:

touch -mt 201212211111 /path_to_the_file/test.doc

Change date to all files

For changing the creation/modification date to all files inside a folder just add /* to the folder path:

touch -t 201212211111 /path_to_the_folder/*

Other way to get this done using find:

find ./path_to_the_folder/ -type f -exec touch -mt 12011200 {} \;

Comments 2

  1. Hi. I tried the ‘touch -t’ to change both Created & Modified date, but it only changed the Modified date – not the Created date.
    So, then I tried the ‘touch -mt’ and it changed the Modified date, like you said, which is fine. But, I need the Created date to change and the instructions didn’t work for that…maybe something has changed since 2015?…wish I knew.

    Thanks for posting instructions, though.

  2. I am very, very surprised that a Mac allows this kind of a modification. I thought one of the main advantages of closed source OS was its integrity and security. Being able to alter the date of a file seems to be a rather significant loophole in my opinion.

    In any case, thanks for the tip. I needed this little hack for a simple tweak on my Mac but I can’t help but wonder how this hack can be misused.

Leave a Reply

Your email address will not be published. Required fields are marked *