Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need a script to set the creation date to the modification date for a bunch of files created by my sound recorder - any way to do this? Running Mac OS X 10.4.11

share|improve this question
Just to help you find a solution: this is stored in the "HFS meta data", in kMDItemFSCreationDate. (UNIX by itself has no notion of a creation date. See superuser.com/questions/43310/… for some details, but that doesn't describe how to change it.) –  Arjan Nov 13 '09 at 8:43
Thanks Arjan, will check out that thread. –  Red Miller Nov 16 '09 at 19:14

1 Answer 1

up vote 7 down vote accepted

You can use SetFile on the command line to do this however it is not included by default in Mac OS X 10.4.x (Tiger). If you have installed the Developer Tools or most of the Combo updates it is installed but in a non standard location. SetFile was included in /usr/bin/ for Mac OS X 10.5 and later.

To find the command you can try using locate to find the location.

Assuming you have the Developer Tools installed:

/Developer/usr/bin/SetFile -d '12/31/2008 12:00:00 PM' nameoffile.txt

You can use another program called GetFileInfo that is installed with SetFile to obtain the modification date.

/Developer/usr/bin/GetFileInfo nameoffile.txt

An example script for one file:

#! /bin/bash
# Usage: nameOfThisScript.sh nameOfFile.txt

modifiedDate=`/usr/bin/GetFileInfo -m $1`
/usr/bin/SetFile -d "$modifiedDate" $1
share|improve this answer
Thanks a lot Chealion! Just what I was looking for. Here's the script so far: #!/bin/bash for i in /Users/MacHD/Music/h2dropbox/* do modifiedDate=/Developer/Tools/GetFileInfo -m $i /Developer/Tools/SetFile -d "$modifiedDate" $i echo $i done –  Red Miller Nov 16 '09 at 19:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.