Mac OS X,  Mac OS X Server

Mac OS X: SetFile

A couple of months ago I wrote about Using SetFile to Make Files Invisible. But today I’m going to discuss using it to change a few other attributes of a file. The options for SetFile include:
SetFile -a can change attributes of a file, such as visibility, locked status, etc.
SetFile -c can change the creator of the file
SetFile -d can change the creation date of the file
SetFile -m can change the modification date of the file
SetFile -t can change the file type

So let’s look at using some of these other options. First let’s take a file called logo.png on my Desktop (~/Desktop) and let’s change out that creator. To do so, we’re going to simply cd into the directory with SetFile in it (/System/Library/ServerSetup in OS X Server) and run:
./SetFile -c charles ~/Desktop/logo.png.

Now we’re going to go ahead and change out the creation date of the file using:
./SetFile -d 01/01/2000 ~/Desktop/logo.png

Now check the GetInfo on the Finder to see if it worked. Now let’s move on to changing the last modification date to be the same as the creation date:
./SetFile -m 01/01/2000 ~/Desktop/logo.png

To check, let’s just look at:
ls -al ~/Desktop/logo.png
-rw-r–r–@ 1 cedge staff 9096 Jan 1 2000 /Users/cedge/Desktop/logo.png

Note: We didn’t change the owner by changing the creator…