changing the creation date of a file

I’d like to be able to change the creation dates for a folder full of files, but this doesn’t seem to be posssible using the following approach…

tell application "Finder"
set the creation date of theFile to date "Saturday, January 1, 2000 12:00:00 AM"
end tell

The Finder returns an error that it can’t set the creation date of the alias (for whatever file has been selected for theFile variable).I’ve been able to use the exact same approach for changing the modification date so I suspect that changing the creation date may be "illegal."Any ideas on how to achieve this goal? Thanks.

Its not illegal, just a little risky. I use a similar script to change modification dates before I upload via FTP. Use this script for drag and drop (folders and nested files withing folders, etc.)

If you wish to get a README with it, email me

on open (thelist)
	(*open receives a list of documents that were dragged onto the droplet's icon, and passes 
	the document names one at a time to the handleTheName routine. *)
	set nowDate to (current date) as date
	set MacintoshCreationDate to date "Tuesday, January 24, 1984 9:00:00 AM"
	set fileCount to 0 as integer
	display dialog ("Enter Creation Date ") ¬
		default answer (nowDate as string) buttons {"Cancel", "OK"} default button 2
	set tempDate to (text returned of result) as text
		set modDate to date tempDate
		set MacCreatDate to date MacintoshCreationDate
		if modDate < MacCreatDate then
			display dialog "The first Macintosh wasn't built yet!" buttons {"Cancel"} ¬
				default button 1 with icon 0 giving up after 5
		else if modDate > nowDate then
			display dialog "Creation date cannot be in the future!" buttons {"Cancel"} ¬
				default button 1 with icon 0 giving up after 5
			repeat with theItems in thelist
				set fileCount to handleTheName(theItems as text, modDate, fileCount)
			end repeat
			tell application "Finder"
				display dialog "The Creation Date for " & (fileCount as string) ¬
					& " File(s) was changed to " & return & (ASCII character 34) & ¬
					(modDate as string) & (ASCII character 34) ¬
					buttons {"OK"} default button 1 giving up after 12
			end tell
		end if
	on error errorMsg number errorNum
		display dialog errorMsg
	end try
end open

on handleTheName(thisItem, modDate, fileCount)
	(*handleTheName determines whether the name passed to it is a file or a folder. If it's
	a file, just tweak the date. If it's a folder, make sure the folder name ends with a colon,
	then get a list of the folder contents. For each item in the folder, prepend the 
	parent folder pathname, then recursively call handleTheName to deal with it. *)
	if folder of (info for file thisItem) is true then
		set theFolderName to thisItem
		if the last character of theFolderName is not ":" then set theFolderName ¬
			to theFolderName & ":"
		set theOtherList to list folder theFolderName
		repeat with theIconName in theOtherList
			set fileCount to handleTheName(theFolderName & theIconName, modDate, fileCount)
		end repeat
		set fileCount to tweakTheDocument(thisItem, modDate, fileCount)
		return (fileCount)
	end if
end handleTheName

on tweakTheDocument(theFileName, modDate, fileCount)
	(*tweakTheDocument checks to see if the passed-in file is any of a number of common files
	that can't be opened.  Otherwise, the creation dates and/or modification dates are changed. *)
	set theExclusionList to {"APPL", "INIT", "PRER", "scri", "RDEV", "cdev", ¬
		"CDEV", "dfil", "DFIL", "ffil", "FFIL", "STAK"}
	set theFileType to the file type of (info for file theFileName)
	if theExclusionList does not contain theFileType then
			set fileInfo to (info for theFileName)
			tell application "Finder"
				set creation date of fileInfo to modDate
				apply catalog info fileInfo to theFileName
			end tell
			set fileCount to (fileCount + 1)
			return (fileCount)
		on error errorMsg number errorNum
		end try
	end if
end tweakTheDocument

If you have access to an OS X machine I have a script that can change creation and modification dates, but it requires OS X and Apple’s Developer Tools

i am looking for similar script that change creation date
i tried all three script with different variation but could not get it work
i working on OS X.2.8

i don’t have any developer tool

pleasegive some suggestion


I have never found a Script to use to change the creation date of a file or folder but I have found an applicaton which does allow changing the creation date of a file or folder. It’s name is “Xray” & shareware but it works.

Give it a looksee ! :lol: