What are the type and creator options in SetFile?
I have read the setfile man page in detail several times, but I still did not understand some commands.
-t type Specifies the file type, where type is a string of exactly four characters.
What exactly is meant by type and how do I use it?
-c creator Specifies the creator of the file, where the creator is a string of exactly four characters.
What does this command do? Does it change the author of the metadata? And how exactly do I use that?
Type and creator are four characters each of metadata which can be applied to a file to indicate the file type and the application or system which could create or consume the file.
You can get the type/creator from a file using /usr/bin/GetFileInfo /path/to/file
:
$ GetFileInfo ~/Downloads/video.mov
file: "/Users/g/Downloads/video.mov"
type: "\0\0\0\0"
creator: "\0\0\0\0"
attributes: avbstclinmedz
created: 12/14/2020 11:16:08
modified: 12/14/2020 11:16:08
- More about the historical use of these fields in Mac OS are described on Fiddling with Type/Creator Codes and File Extensions - O’Reilly, such as HTML files having type
TEXT
and creatorMSIE
for Microsoft Internet Explorer. - Nowadays in macOS these fields are likely empty on files you encounter.