Changing creation date

I can get the creation date of a file with “creation date of info for file…” but how can i change it? (to change the creation date on images from a camera with a wrong date) “set creation date of info for file… to date…” doesn’t work.

info for is a read only record according to the Standard Additions dictionary. You’ll probably have to go after it with a shell script.

Someone may say differently here - but I don’t think your going to find any shell scripts or utilities that allow for changing of the creation date. Think about it, if you were able to do that - you would be lying to the computer… It doesn’t make sense to me that there would be any mechanisim to do that at all. If you did find one - it would be a great hacker tool.

Agree completely, but didn’t say so earlier. If you could change creation date, timed software demos wouldn’t be demos, patent arguments would fail, emails could be altered, etc.

If you have the Developer packages installed: /Developer/Tools/SetFile

Actually, changing creation dates is a fairly common thing. In the PC world you can find a ton of utilities for this (they call it “touching files”.) And only bad coders allow for software protection to be defeated by such trivial things as touching files or changing your system clock!:stuck_out_tongue:

Jim Neumann

In OS X, touching the file resets its modification date.

Yep - your right - I never used SetFile that way - guess I never thought of that. That concerns me though. I know if people at my work knew that - there would be a lot of this going on… “Look - I created this file 2 days ago, just look at the creation date…”

But just to clarify - if you touch a file - with no flags. it will set the Modified time of the file - to the current time - which is the way I normally use it.

so if i write a script to do this it wil work only if the user has the developer tools, or is that just the documentation (i’m currently on a computer without the dev tools, but later today i’ll check it on my ibook) and how would i use it within AS? (do shell script?)

If you can’t count on a user having the Developer Tools installed, then you might be able to save your script or application as a bundle, and save the SetFile executable inside the bundle (while technically possible, I’m uncertain if there would be any legal issues involved).

Yes, you would use do shell script.

the problem is that i do want to aintain the date relitivity (ex. i set the first image to be jan 1 2005 instead of april 12 2003, and the second image is set for april 13 2003, i want it to automatcally be set to jan 2 2005, and not jan 1)

could you please give me an example how to use it? i tried using it through terminal on my mac with dev tools instaled, but it’s not working, and i’m not so good with unix commands.

You’ll have to change the details, but this works for me:

set F to "~/Desktop/SafariForm/SafariWrite1.scpt" -- a file in a folder on my desktop
do shell script "/Developer/Tools/SetFile -d 12/25/2005 " & F  -- the date has to be in that format

Thanks! :smiley: