Set file creation date by reading modified date

2

1

How can I set a file's creation date as the modified date?

e.g. File is made on Monday, edited on Tuesday. On Wednesday I want the date modified and date created to be set to Tuesday.

Thanks!

Harry Fear

Posted 2011-08-27T20:59:01.120

Reputation: 21

1Which Apple OS are you running? OS X runs on top of Unix and Unix file systems do not track the creation date. – garyjohn – 2011-08-28T01:54:01.923

@garyjohn OS X has separate Created dates and Modified dates in the get info box... not sure what you mean. – Vervious – 2011-08-29T04:20:18.847

@Nano8Blazex: I guess I mean I have a limited understanding of OS X. From a little Googling it appears that OS X does track the creation time but that not all programs access it. Harry Fear: You might find this program useful: http://www.hamsoftengineering.com/codeSharing/ChangeFileDates/ChangeFileDates.html.

– garyjohn – 2011-08-29T05:20:22.127

Answers

1

f=test.txt
SetFile -d "$(GetFileInfo -m "$f")" "$f"

GetFileInfo and SetFile are part of the command line tools package, which can be downloaded from developer.apple.com/downloads or from Xcode's preferences after installing it from the App Store.

Joel Reid

Posted 2011-08-27T20:59:01.120

Reputation: 141