Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

macstatic

macrumors 68020
Original poster
Oct 21, 2005
2,029
168
Norway
I'm looking for a tool (which can be used in an Automator script) which allows me to change the file Creation date. I've been suggested the touch command, but even though I've come across lots of forums discussions etc. where it's said it can change the creation date but I haven't been able to reproduce that. According to its man-page touch can only change the modification and access times/dates (I assume the latter is the same as last opened in OSX).
A Better Finder Attributes does what I'm looking for but alas isn't scriptable.
 
Thanks!
I should have mentioned this initially, but do you know if it could be used to create an Automator application where the actual date to be changed to is determined by the results of another tool? It seems to be limited to the following two options:

1) change date created to: current date and time
2) change date created to: xxxxxxxxxxx

Let me explain....
I'll be using the command-line tool EXIFtool to read an image-file's time/date tag inside its EXIF header, then write that date back to the same file's creation date (because certain image software messes with the creation date, so fetching it back from the EXIF header will fix that).
Unfortunately EXIFtool doesn't have the ability to write system-related stuff like that, so I need to look into other tools for that specific job.
With my limited experience in scripting I'm thinking that the time/date value EXIFtool finds (using a terminal command in a "Run shell script" action) could be passed on as a variable to whatever can write the creation date. Perhaps there are better ways to do this...
 
Thanks Flynnstone.
After several tests I found out you can't change the creation date to anything later than the already existing creation date, only earlier. I believe that didn't apply with earlier versions of OSX.
This may or may not be a problem for my task, but in the meantime I just found another command called setfile and it appears to do what I want (change just the creator date/time). The downside is its non-standard date-format and the fact that it has to be downloaded separately along with the huge Xcode developer tools from Apple.
Does anyone know if it can be downloaded on its own, or if Apple allows redistributing it on its own? If I succeed in completing my script I'd like to share it with others, and as such it shouldn't be a huge hassle for most people to install.
Are there ways to embed terminal commands like these into a script of some sort so that people don't have to download an install a bunch of additional tools as well?

By the way, in case anyone's interested (apparently, according to lots of forum discussions on the matter, changing the creation date seems to be one of those things which are hard/impossible to do), here's the syntax I used to change a file's (a JPG in the example below) creation date to Jan 31st 2014, 13:21.

$ setfile -d "01/31/2014 13:21" FILENAME.JPG
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.