Change File Created Date and Time using Mac Terminal Command

If you have a file on your Mac and you want to change its created date and time (timestamp) then you can do that using the Terminal app as follows.

% ls -l | grep myfile.csv 

-rw-r--r--  1 c2ctechtv  staff      0 Sep  7 12:51 myfile.csv

Here, we have a file myfile.csv with the created date as September 7th at 12:51 hours.

Now let's change this date to 4th of July 2023 and time as 03:00 hours.

% SetFile -d '07/04/2023 03:00:00' myfile.csv

If you want, you can also create a file with a date for the future or past using the touch command and -mt flag.

touch -mt YYYYMMDDhhmm <file-name.extension>
touch -mt 202101010100 myfile.csv
Change File Created Date using Mac Terminal Example

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap