Change a file’s creation/modified date on Mac OS X

This is a very simple guide on how to change a file’s creation date or last modified date attributes on Mac OS X.  Based on Snow Leopard 10.6, this should work on previous versions of Mac OS X.


Date Format Key:

     YYYY – The year (the first two digits/century can be omitted)
     MM – The month of 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

Creation Date – Single file

How to change the creation date attribute of a single file:
Note: changing the creation date attribute will also change the modified date attribute and set it the same as the creation date.

  1. Start the Terminal application (/Applications/Utilities/Terminal.app) or if you prefer use iTerm.
  2. Type the following in the command line, but do not hit enter/return.  Replace YYYYMMDDhhmm with the desired date information:
    touch –t YYYYMMDDhhmm
  3. Open a Finder window and locate the file you wish to modify.  Drag and drop the file into the Terminal window, the file and path will be added to the end of the line you just typed. 

    Here is an example of what the line should look like:

    touch –t 200005151125 /Volumes/Mac\ HD/Pictures/myfile.jpg

    200005151125 in the example above represents 15th May 2000 11:25 AM.

  4. If all is in order press the enter/return key.  The creation date should now be changed to the date specified above, as well as the last modified date.

Modified Date – Single file

How to change the last modified date attribute of a single file:

  1. Start the Terminal application (/Applications/Utilities/Terminal.app) or if you prefer use iTerm.
  2. Type the following in the command line, but do not hit enter/return.  Replace YYYYMMDDhhmm with the desired date information:

    touch –mt YYYYMMDDhhmm

  3. Open a Finder window and locate the file you wish to modify.  Drag and drop the file into the Terminal window, the file and path will be added to the end of the line you just typed. 

    Here is an example of what the line should look like:

    touch –mt 201006301525 /Volumes/Mac\ HD/Pictures/myfile.jpg

    201006301525 in the example above represents 30th June 2010 3:25 PM.

  4. If all is in order press the enter/return key.  The last modified date should now be changed to the date specified above.

Creation Date – Multiple files

How to change the creation date attribute of multiple files:

Note: changing the creation date attribute will also change the modified date attribute and set it the same as the creation date.

  1. Make sure all the files you want changing are in the top directory of the same folder.  Do not place files in this folder if you don’t want them to be modified.
  2. Start the Terminal application (/Applications/Utilities/Terminal.app) or if you prefer use iTerm.
  3. Type the following in the command line, but do not hit enter/return.  Replace YYYYMMDDhhmm with the desired date information:

    touch –t YYYYMMDDhhmm
  4. Open a Finder window and locate the folder containing the files you wish to modify.  Drag and drop the folder into the Terminal window, the folder and path will be added to the end of the line you just typed. 

    Here is an example of what the line should look like:

    touch –t 201004270930 /Volumes/Mac\ HD/Pictures/Album

    201004270930 in the example above represents 27th April 2010 09:30 AM.

  5. Add /* to the end of the command.  If you’re only targeting a specific file type include its extension (e.g. /*.jpg).  Your command should look something like this:
    touch –mt 201004270930 /Volumes/Mac\ HD/Pictures/Album/*

    or

    touch –mt 201004270930 /Volumes/Mac\ HD/Pictures/Album/*.jpg
  6. If all is in order press the enter/return key.  The creation date should now be changed to the date specified above, as well as the last modified date, for all the files within that folder.

Modified Date – Multiple files

How to change the last modified date attribute of multiple files:

  1. Make sure all the files you want changing are in the top directory of the same folder.  Do not place files in this folder if you don’t want them to be modified.
  2. Start the Terminal application (/Applications/Utilities/Terminal.app) or if you prefer use iTerm.
  3. Type the following in the command line, but do not hit enter/return.  Replace YYYYMMDDhhmm with the desired date information:

    touch –mt YYYYMMDDhhmm
  4. Open a Finder window and locate the folder containing the files you wish to modify.  Drag and drop the folder into the Terminal window, the folder and path will be added to the end of the line you just typed. 

    Here is an example of what the line should look like:

    touch –mt 201006081015 /Volumes/Mac\ HD/Pictures/Album

    201006081015 in the example above represents 8th June 2010 10:15 AM.

  5. Add /* to the end of the command.  If you’re only targeting a specific file type include its extension (e.g. /*.jpg).  Your command should look something like this:
    touch –mt 201006081015 /Volumes/Mac\ HD/Pictures/Album/*

    or

    touch –mt 201006081015 /Volumes/Mac\ HD/Pictures/Album/*.jpg
  6. If all is in order press the enter/return key.  The last modified date should now be changed to the date specified above, for all the files within that folder.

Hope you found this tutorial somewhat useful.

66 comments

  1. hello- i tried to change the modified date by using your steps. the date i tried is touch -mt 200905191235

    i get the same error message no matter what i do:
    touch: out of range or illegal time specification:

    what do i do?

    1. The post was based on UK time format? which localisation is set on your mac? you may need to swap the dates from YYYYMMDD to YYYYDDMM

    2. The best and easy method is
      1. change the current date and time in preference to desired one
      2. open word blank document
      3. copy the content of old document and paste in blank document
      4. do setting according to your choice
      5. save
      6. Hurrey you ‘ll get the document with desired date

    3. you better check again. because in my case you know what I also have same as your problem for the first time. the problem is I typed touch -t 2017032819 and the error appear to touch: error out of range or illegal time specification.
      I fixed by typed touch -t 201703281119. hope that still help seem I reply late

  2. For me everything work perfectly except
    that I need to change a folder with about
    121 jpg files and it need to be different date.
    Like the first one would be 201006191530 and the
    next one should be the same but plus 1. Because
    I would like to transfert the picture on a Kodak digital frame
    and it’s sort the pictures but creation date.
    Now all my picture play in a random way and not in the order
    it was taker (like a wedding)
    Can you help me
    Thanks

    1. This is really late but you will do the above instructions and just place (*) for all files beginning with that will change. Example:
      touch -t YYYYDDMMhhmm /Users/…../IMG*
      IMG being all files in that folder that begin with that text will be changed to the date specified.

  3. Had hopes for this technique, but it only changes the access and modification dates/times, not the creation date/time. Is there another Terminal command that will do this?

  4. I wanted to change just a creation date of my jpg’s. Keep the time as is. Is there a way of doing it?
    I took lots of pictures during my vacation and my camera date was set wrong, but the time was correct. Please help!

  5. Tried to do this and got the message “no such file or directory”. Any idea why that would happen? Seems strange since I was dragging the doc there.

    1. Hi Tom, I’ve been getting the error messages until I followed your advice and put a space after the date and before the file. Thanks!

    2. This did the trick, Tom! Thanks for the extra push in getting this problem solved.

      Who knew one little ‘space’ would make all the difference. ¯\_(ツ)_/¯

  6. I was puzzled, that your commands did not work for me.
    The command simply created several files for me.

    That happened, because I copied and pasted one of your examples, instead of reading and typing it: In my browser, your examples are presented with a long dash instead of a minus symbol in front of the letter “t”, which will fail…

  7. I have a list of files in dir with creationdatetime.mp4
    20120221160836.mp4 Today
    20120221183038.mp4 Today
    20120221190710.mp4 Today

    How can I with a script (apple) modify creation date/time of those files with the date/time in the filename?

    thanks
    Henry

    1. $ for i in `ls *.mp4`; do touch -mt ${i:0:12} $i; done
      $ ls -l
      total 0
      -rw-r–r– 1 user staff 0 Feb 21 2012 20120221160836.mp4
      -rw-r–r– 1 user staff 0 Feb 21 2012 20120221183038.mp4
      -rw-r–r– 1 user staff 0 Feb 21 2012 20120221190710.mp4

  8. Hi! I really need this for a photography assignment, i want to re use some old photos i took, but i keep getting this message:

    -bash: [[21]12]11241545[.08]: command not found
    MacBook-Pro-de-Andrea:~ Andrea$

    Help please!

  9. Hi!! I tried using your code for change the creation date (touch -t) but it only changes the modification date. please help!!

  10. FML! I have been trying to work this out for what seems like my entire existence. Can’t believe how easy that was. Fist bump that sh!t. THANK YOU!!!

  11. I used your code and the creation and modification date are correct in the ‘file info box’ in finder, but when you go into ‘properties’ when the file is open in word the creation date is the original still. How can I change this?

    In properties it also says that it was printed at a random date over a year ago when this file didn’t exist!

  12. Thanks for this info !

    Been trying to make some order in my pictures for uploading to PictureLife, in replacement for the now defunct Everpix…

    Great tip !

  13. Hi
    I have made an audio slideshow and wanted to change “modification date”. I have followed your very clear instructions but keep getting this message -

    touch: out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]

    Can you help? Sorry to bother you but you seem to be on the ball! Tricia

    1. What’s the precise command string you’re using?

      The error you’re receiving seems to indicate you’re missing something.

  14. The procedure to change a file’s creation date no longer works. It used to work a while ago but now, when used according to the specifications above, it says:”touch: out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]”
    Could you please explain what should be done. Thank you very much!

  15. Thanks, worked perfectly for me on 10.6.8 (Snow Leopard). Although, on the first attempt I failed to leave a blank space between the date/time specification and the file path (that I dragged and dropped). Once I tried again and input a blank space after the date/time specification and before the file path, all worked as advertised, for both created by date and for modified by date.

  16. For all those who tried the above code and didn’t work: You have to leave a space between the last digit of the date you insert and then drag and drop the file. If created date doesn’t change and only modified date changes no matter what you do, then type: touch -ct YYYYMMDDhhmm. It changes the ‘created date’ and at least it worked for me (Mac mini 2013, Mountain Lion). I hope it helps.

  17. I am having problems changing a created and modified date on two Microsoft Mac Word files. I am using a macbook pro with OS X version 10.9.4.
    The terminal server command does not work – permission denied error – when I use the command:touch –t YYYYMMDDhhmm of touch –t YYYYDDMMhhmm.
    I drop the file into the terminal window and get the appropriate extension, then add/* –
    I then get a string of denied permission error commands.
    Any ideas what I am doing wrong?

  18. hi…
    in a folder’s file name,size,modified date every thing is showing….but size,modified date is not so clearly visible….hard to read….what can b done…

  19. I tried this on my MP4 files but it only changes the modified date while I used touch -t ………
    anybody else tried it on a MP4 file?

  20. Can you tell me why I got the message “no such file” when I dragged and dropped the file to the terminal? tried different files but same message popped up.

  21. trying to change a date of created pictures I get this message:
    touch: out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]
    please, tell what should I do? and if something missing – what is it? Thanks much.

      1. Using OS X 10.9.5 Acrobat Pro DC, I think I follow the directions, when it is accepting what I enter it does not modify anything. I am trying to modify a date created. Or else, I receive the same error message some others have received. Suggestions? Thank you

  22. I tried the suggestions above. I tried using both, -t and -ct, but only the modified date and last accessed dates are changing. I cannot seem to get the creation date to change. I am using Yosemite 10.10.2. Please advise. Thanks!

  23. Brilliant! Thanks Rajesh.
    I’m using Yosemite 10.10.3 and it works beautifully.
    A word of caution, and to second Tom’s useful advice, if you’re getting “touch: out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]” you just need to hit space once before you drag in your file. I got that error message a couple of times, but now all my video files’ creation date has been changed. And no need for third party software!

  24. Worked for me on a .pdf file
    As someone else pointed out early on if you copy and paste you have to change the – dash sign to a minus sign -.
    Using Yosemite 10.10.5

  25. I have a large folder that is grayed out on my Synology NAS. Creation date is 1984. Multiplpe folders inside have correct dates. Tried “touch -t” with date, hor, min and seconds but I got “touch: out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]” several times. Then I entered date without seconds – no error message but date of creation did not change. Using OS 10.9.5
    Any suggestion?

  26. For those of you who tried to change the creation date with no success: you have to type “touch t” (without the minus sign), not “touch -t”.

  27. No one talks about how -t DOESN’T CHANGE the creation date. I mean, if you are going to make the title “change creation/modified date then show that!!

    Anyway, if you TRULY want to change the CREATION data, you can do this with SetFile command here is an example:

    SetFile -d ‘MM/DD/YYYY hh:mm:ss’ file.txt
    SetFile -d ‘MM/DD/YYYY hh:mm:ss’ /Volumes/Mac\ HD/Pictures/file.jpg
    Multiple Files in a folder:
    SetFile -d ‘MM/DD/YYYY hh:mm:ss’ /Volumes/Mac\ HD/Pictures/IMG* (or what ever the common name between files)

  28. For those asking why Date Created is not changing when using the touch -t command, I found out you can only go backwards with the date and not forwards. I wanted to change my file from Jan 18 to Jan 19 and it wouldn’t work, so I tried going backwards to Jan 17 and it worked fine.

    1. This is actually the most helpful comment regarding this issue.
      So, if you changed the date too far back and want to fix it, you can just recreate the file. Create a new word document, take a screenshot of the picture, or upload and then download the movie file, and it should revert back to today’s date, then you just do the steps again and it should work fine!

  29. This still works on OS X El Capitan (10.11.5) – like people said before, if you copy and paste into terminal, you have to change from a dash to a minus sign. Works wonders

  30. Hi. I’m a video editor just curious about digital forensics. My friend came to me and asked if there was any way to ascertain a pic / video file’s authenticity. I don’t believe he has any way of knowing if the files he has are the originals (he gave them to me on CD-R). After a bit of research, I’m puzzled why so many resources to change timestamp, etc.! I know a small bit now about comparing hash terms (need the original) and getting metadata using mdls in Terminal. I suppose he’s up a creek if no originals are available to check against, huh? A 2nd question: does Terminal’s info revealing ContentCreationDate and ContentChangeDate are the same tell me anything significant. Thanks a lot if you take time to answer. Fascinating stuff!

Leave a Reply to andrea Cancel reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>