You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

change the date file created

I have big sure and I am trying to change the date a file was created in terminal but it does not recognise the command

iMac 21.5″ 4K, macOS 11.5

Posted on Sep 5, 2021 4:50 AM

Reply
Question marked as Top-ranking reply

Posted on Sep 5, 2021 11:13 AM

The UNIX shell is unforgiving when you don't follow command syntax rules. Replace foo.jpg below with your image path/name. I have entered the Terminal syntax here using the <> tool on this editor's toolbar.


touch -t 202106061111.00 foo.jpg


In addition to entering x-man-page://touch in Safari's address field, you can also open the touch man page variously as:


man touch


or


man -t touch | open -f -a Preview


9 replies
Question marked as Top-ranking reply

Sep 5, 2021 11:13 AM in response to blue4dolphin

The UNIX shell is unforgiving when you don't follow command syntax rules. Replace foo.jpg below with your image path/name. I have entered the Terminal syntax here using the <> tool on this editor's toolbar.


touch -t 202106061111.00 foo.jpg


In addition to entering x-man-page://touch in Safari's address field, you can also open the touch man page variously as:


man touch


or


man -t touch | open -f -a Preview


Sep 11, 2021 10:02 AM in response to VikingOSX

ok well I have managed to change the modified date is there a way to change the creation date?

What confused me was when you spoke about typing things in the Safari address bar.

I do not understand this bit In addition to entering x-man-page://touch in Safari's address field, you can also open the touch man page variously as:


man touch


or


man -t touch | open -f -a Preview



I did the first part into the terminal and replaced foo.jpg

Sep 11, 2021 11:15 AM in response to blue4dolphin

I should have remembered that the touch command cannot change the creation date of a file. If you have Xcode or the command-line tools for Xcode installed, you will have the setfile command, which does allow one to change the file creation date.


setfile -d "09/11/2021 14:05:00" xyz.txt


When verified in a Get Info window for this file, the creation date/time is set to 2:05 pm for that date.

change the date file created

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.