How to Change a File’s Last Modified and Creation Dates on Mac OS X

Danilo Stern-Sapad
Jun 18, 2015 · 5 min read

This a very simple guide on how to change a file’s “date modified” and “date created” attributes on Mac OS X I wrote back in May 2009. Since then these directions have been updated for Mac OS X 10.10 Yosemite.

Date Format Key:
YYYY — The year (the first two digits/century can be omitted).
MM — The month of the year, from 1 to 12.
DD — The day of the month, from 1 to 31.
hh — The hour of the day, from 0 to 23.
mm — The number indicating minutes, from 0 to 59.

How to change the “date modified” attribute of a file?
1. Open up the Terminal application (/Applications/Utilities/Terminal.app) or if you prefer use iTerm.

2. Type this into Terminal (without hitting enter/return) replacing YYYYMMDDhhmm with the desired date information:

touch -mt YYYYMMDDhhmm

3. Open a Finder window and locate the file you wish to modify and drag and drop it into the Terminal window. Here’s an example of what should be typed into the Terminal at this point:

touch -mt 200801120000 /Volumes/Mac\ HD/Pictures/somefile.jpg

200801120000 in the example above represents “January 12, 2008 at 12:00 AM” or my twenty-first birthday. Make sure to change 200801120000 to the date you want and to replace /Volumes/Mac\ HD/Pictures/somefile.jpg with the proper path to the file you wish to alter the date for.

4. If all is in order press the return key.

How to change the “date created” attribute of a file?
Warning: This will change both the “date modified” and “date created” attributes.

1. Open up the Terminal application (/Applications/Utilities/Terminal.app) or if you prefer use iTerm.

2. Type this into Terminal (without hitting enter/return) replacing YYYYMMDDhhmm with the desired date information:

touch -t 201212211111

3. Open a Finder window and locate the file you wish to modify and drag and drop it into the Terminal window. Here’s an example of what should be typed into the Terminal at this point:

touch -t 201212211111 /Volumes/Mac\ HD/Pictures/somefile.jpg

201212211111 in the example above represent “December 21, 2012 11:11 AM” or the end of the 5,125 years that comprise the “Great Cycle” in the sacred Tzolk’in calendar of the Maya (and you can relax the world didn’t end then — and I didn’t think it would when I wrote this article!). Make sure to change 201212211111 to the date you want and to replace /Volumes/Mac\ HD/Pictures/somefile.jpg with the proper path to the file you wish to alter the date for.

4. If all is in order press the return key.

Below is supplementary information on how to batch modify/update/change files using the commands above.

How to batch update the “date modified” attribute of multiple files? 1. Make sure all the files you want to modify are in the top directory of the same folder. Don’t store files in this folder if you don’t want them to be modified.

2. Open up the Terminal application (/Applications/Utilities/Terminal.app) or if you prefer use iTerm.

3. Type this into Terminal (without hitting enter/return) replacing 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 and drag and drop it into the Terminal window. Here’s an example of what should be typed into the Terminal at this point:

touch -mt 200801120000 /Volumes/Mac\ HD/Pictures/Album

5. Add /* to the end of the command. If you’re only targeting a specific file type include its extension (e.g. /*.jpg or /*.png). Your command should look something like this:

touch -mt 200801120000 /Volumes/Mac\ HD/Pictures/Album/*

6. If all is in order press the return key.

How to batch update the “date created” attribute of multiple files?
Warning: This will change both the “date modified” and “date created” attributes.

1. Make sure all the files you want to modify are in the top directory of the same folder. Don’t store files in this folder if you don’t want them to be modified.

2. Open up the Terminal application (/Applications/Utilities/Terminal.app) or if you prefer use iTerm.

3. Type this into Terminal (without hitting enter/return) replacing YYYYMMDDhhmm with the desired date information:

touch -t 201212211111

4. Open a Finder window and locate the folder containing the files you wish to modify and drag and drop it into the Terminal window. Here’s an example of what should be typed into the Terminal at this point:

touch -t 201212211111 /Volumes/Mac\ HD/Pictures/Album

201212211111 in the example above represent “December 21, 2012 11:11 AM”. Make sure to change 201212211111 to the date you want and to replace /Volumes/Mac\ HD/Pictures/Album with the proper path to the folder containing the files you wish to alter the date for.

5. Add /* to the end of the command. If you’re only targeting a specific file type include its extension (e.g. /*.jpg or /*.png). Your command should look something like this:

touch -t 201212211111 /Volumes/Mac\ HD/Pictures/Album/*

6. If all is in order press the return key.

Hope you enjoyed or at least found this tutorial useful. If you have any questions or comments let me know!

Originally published at http://danilo.ariadoss.com on May 31, 2009.

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Hacker Noon is how hackers start their afternoons. We’re a part of the @AMI family. We are now accepting submissions and happy to discuss advertising & sponsorship opportunities.

If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!

Image for post
Image for post

Sign up for Get Better Tech Emails via HackerNoon.com

By HackerNoon.com

how hackers start their afternoons. the real shit is on hackernoon.com. Take a look

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Danilo Stern-Sapad

Written by

Entrepreneur, Technologist & Product Guy

HackerNoon.com

Elijah McClain, George Floyd, Eric Garner, Breonna Taylor, Ahmaud Arbery, Michael Brown, Oscar Grant, Atatiana Jefferson, Tamir Rice, Bettie Jones, Botham Jean

Danilo Stern-Sapad

Written by

Entrepreneur, Technologist & Product Guy

HackerNoon.com

Elijah McClain, George Floyd, Eric Garner, Breonna Taylor, Ahmaud Arbery, Michael Brown, Oscar Grant, Atatiana Jefferson, Tamir Rice, Bettie Jones, Botham Jean

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store