Change the creation date of files using relative dates

Jun 02, '10 07:30:00AM

Contributed by: philostein

I was looking for a way to change the creation date of a file and I found this hint, and through that, the ChangeFileDates command line tool at hamsoftengineering.com. I noticed that ChangeFileDates will accept some pretty vague relative dates as valid inputs!

I have written an Applescript (details below) that uses ChangeFileDates to change the creation and modification dates of one selected file, and returns the new dates for checking. Useful for an exported camera movie, for example. It differs from other Applescripts in allowing ChangeFileDates to use 'colloquial specification of dates' (from dateWithNaturalLanguageString in NSDate), such as:

However, dateWithNaturalLanguageString does warn that: 'This method supports only a limited set of colloquial phrases, primarily in English. It may give unexpected results, and its use is strongly discouraged.' They work though! (Please check your results.)

The creation date can be copied and pasted straight from a file's Get Info window - e.g. Thursday, June 4, 2009 5:33 PM. Also, the creation date can be hidden in Finder using Friday, January 1, 1904 09:00:00 AM. This date through to Tuesday, January 19, 2038 12:14:00 PM seems to be the range of the process. Don't expect any sensible results outside this range!

My script provides the current creation date, and will use the input to change both the creation and modification dates, unless 'Modification' is selected. It won't allow the creation date to go beyond the modification date. Occasionally only one, instead of both, of the dates change. Click 'Re-send' if the dates don't check out.

You need to download ChangeFileDates (from the HAMSoft site referenced above), unzip it, and put it in a (likely created by you) ChangeFileDates folder in ~/Library/Application Support/ (as implemented by Daniel Shockley). Check 'Show Script menu in menu bar' in Applescript Editor's Preferences, and put the script in ~/Library/Scripts/Applications/Finder for use from the menu bar in Finder. If anyone is interested in a multi-file/folder version, please post a comment.

Thanks to HAMSoft Engineering for helping me collate some info, and Daniel Shockley for pointing out ChangeFileDates.

[crarko adds: I tested this, and it works as described. You do need to put the files in the exact locations described in the hint. I've mirrored the Applescript here.]

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20100529052920915