Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Change the creation date of files using relative dates System
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:

  • now
  • yesterday morning (10 AM)
  • 1AM tomorrow
  • nextday (the day after tomorrow)
  • today lunch (12 PM)
  • wed (the next Wednesday coming)
  • next week
  • last month
  • August (this year)
  • 2 (2nd of this month)
  • 3rd
  • 3:15PM (today)
  • 4 of Jan 2008
  • Mar 2009 2nd
  • last Tuesday at dinner (Yes, really!)
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.]
    •    
  • Currently 2.92 / 5
  You rated: 5 / 5 (12 votes cast)
 
[7,626 views]  

Change the creation date of files using relative dates | 5 comments | Create New Account
Click here to return to the 'Change the creation date of files using relative dates ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Change the creation date of files using relative dates
Authored by: asmeurer on Jun 02, '10 09:47:08AM

Cool. This must be the workhorse behind data detectors in Mail.



[ Reply to This | # ]
Change the creation date of files using relative dates
Authored by: airdog242 on Jun 02, '10 11:56:40AM

You can also change dates on a file using an application like FileXaminer



[ Reply to This | # ]
Change the creation date of files using relative dates
Authored by: thatboy on Jun 08, '10 10:01:47AM

Holding the computer down worked here after everything all was exhuasted. Thanks peops.



[ Reply to This | # ]
Change the creation date of files using relative dates
Authored by: Charles Burns on Jan 02, '12 11:49:21AM

This hint still works in Lion. I would be interested in modifying a number of files at the same time if anybody knows how to modify the script to do this please.



[ Reply to This | # ]
Change the creation date of files using relative dates
Authored by: philostein on Jan 04, '12 02:41:18AM
Here's a multi-file selection version:

Change creation and modification dates (multiple files).scpt

It runs a Terminal command for each file, so caution is advised if you're changing a shed-load of files. I've only done minimal testing, so let me know if it works well for you.

I wanted to run one command for each batch like this:

Users/phil/Library/Application Support/ChangeFileDates/ChangeFileDates' -cDate '1/3/12 18:00:00' -mDate '1/3/12 18:00:00' -file '/Users/phil/Test folders/Test folder 1/Test copy 2.rtf' -file '/Users/phil/Test folders/Test folder 1/Test copy.rtf' -file '/Users/phil/Test folders/Test folder 1/Test.rtf'

or this:

'/Users/phil/Library/Application Support/ChangeFileDates/ChangeFileDates' -cDate '1/1/09 18:00:00' -mDate '1/1/09 18:00:00' -file '/Users/phil/Test folders/Test folder 1/Test copy 2.rtf' '/Users/phil/Test folders/Test folder 1/Test copy.rtf' '/Users/phil/Test folders/Test folder 1/Test.rtf'

but ChangeFileDates would only act on the last -file prepended path. Anyone know how to do this?

[ Reply to This | # ]