creation date?

good morning,

I’m trying to modify the Apple supplied scrpt that changes tif files into jpegs but I’m trying to get the new files to keep the creation date of the old file. From what I’m hearing this may not be possible, but I did notice an odd bit of behavior when testing things, and that is that when I set the modification date of a file to older than the current creation date the system automicattly makes the creation date the same as the modificatoin date. Now that isn’t exactly what I want but I’ll take it if I have to.

Does anybody know any other way to change the creation date of a file?

dustin

You have the *nix tool “SetFile” (installed with Developer Tools at “/Developer/Tools/SetFile”) → do a “man SetFile” in a Terminal window for usage, and call it thru “do shell script”
Your hack is OK (since ancient times, as far as I know).
I’m forgetting something else… Hmmm…

You could try a bit of cloning, I suppose. :wink: Transfer the nucleus of a temporary JPEG version to a renamed and recoded duplicate of the TIFF file. The duplicate will then be a JPEG with the original creation date. A bit Heath Robinson, but it works in Tiger.

set tiffPath to (choose file of type {"TIFF"}) as Unicode text

-- Get the TIFF file's name and the path to its container.
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set tiffName to tiffPath's last text item
set containerPath to tiffPath's text 1 thru text item -2 & ":"
-- Use the TIFF name as the basis for the JPEG name.
set AppleScript's text item delimiters to "."
set jpegName to tiffName's first text item & ".jpeg"
set AppleScript's text item delimiters to astid

-- Duplicate the TIFF file. The duplicate will have the same creation date.
-- Change the duplicate's name and file type to JPEG identifiers.
tell application "Finder"
	set (duplicate file tiffPath)'s name to jpegName
	set jpegPath to containerPath & jpegName
	set file jpegPath's file type to "JPEG"
end tell

-- Open the TIFF file in Image Events and save the image as a JPEG in a temporary file.
set tempPath to (path to temporary items as Unicode text) & ".jpeg"
tell application "Image Events"
	launch
	open file tiffPath
	save image 1 as JPEG in tempPath
	quit
end tell

-- Replace the duplicate file's contents with the contents of the temporary file.
set fRef to (open for access file jpegPath with write permission)
try
	set eof fRef to 0
	write (read file tempPath) to fRef
end try
close access fRef