SETFILE(1)

NAME
SetFile - sets file attributes

SYNOPSIS
SetFile file1 [file2]... [ -a attributes ] [ -c creator ] [ -d date ] [ -l h , v ] [ -m date ] [ -noResolve ] [ -t type ]

DESCRIPTION
The SetFile command sets attributes for one or more files. The options apply to all files listed.

INPUT
None

OUTPUT
None

ALIAS RESOLUTION
This command resolves Finder aliases used as part of any pathname or filename specification. You may use the option -noResolve to override this behavior, which allows you to use SetFile to set the attributes of your Finder alias file.

STATUS
SetFile can return the following status codes:

0   attributes set
1   syntax error
2   any other error

PARAMETERS

file1 [file2] ...
    Specifies one or more files.

OPTIONS

-a attributes
    Sets the file attribute bits, where attributes is a string of case-sensitive letters. Each letter corresponds to a file attribute: an uppercase letter indicates that the attribute bit is set (1); a lowercase letter indicates that it is not (0). These are the same attributes that are displayed for files in the -l and -x options of the Files command. The letters and their meanings when set are given below. Note that attributes that are not specified in the command line remain unchanged.

    Attr
        Meaning when set
    A | a
        Finder alias file.
    V | v
        Invisible. *
    B | b
        Has bundle.
    S | s
        System file.
    T | t
        Stationery file.
    C | c
        File has custom icon.
    O | o
        File is open.
    L | l
        Write-locked.
    I | i
        Initialized (that is, the Finder is aware of this file and has given it a location in a window). *
    N | n
        File has no 'INIT' resource.
    M | m
        Shared file (can be launched multiple times).
    W | w
        Always switch launch (if possible).
    D | d
        Located on the desktop. Note that this attribute is not used in System 7. *

    * This attribute can also be set for folders.

    Note
    These attributes are described in the chapter about the File Manager in Inside Macintosh.

-c creator
    Specifies the file's creator, where creator is a string of exactly four characters. For example,

    -c 'MPS '

-d date
    Sets the creation date, where date is a string of the form

    "mm/dd/yy [ hh:mm[:ss] [ AM | PM ] ]"

    representing the month, day, year (0-99), hour (0-23), minute, and second. Note that you must enclose the string in quotation marks if it contains spaces and that, as a convenience, you can use a period ( . ) instead of the form shown above to indicate the current date and time.

-l h,v
    Sets the icon location, where h and v are positive integer values that represent the horizontal and vertical pixel offsets from the upper-left corner of the enclosing window.

-m date
    Sets the modification date, where date is a string of the same format used for -d. As a convenience you can use a period ( . ) in place of the usual date string to indicate the current date and time.

-noResolve
    Prevents SetFile from resolving the leaf alias in the input file path. This lets you act on the Finder alias file rather than its target file.

-t type
    Sets the file type, where type is a string of exactly four characters. For example:

    -t 'TEXT'

EXAMPLES
The following command line sets the creator and type for the ResEqual tool:

SetFile ResEqual -c "MPS " -t MPST

This command line sets the modification date of the myFile file:

SetFile myFile -m "5/13/92 12:29"

Using a period (.) as a parameter to -m, the following command line sets the modification date of the myFile and Bar files to the current date and time. Setting the date is useful, for instance, before running the Make tool.

SetFile myFile Bar -m

SEE ALSO
Files