Name

setfile - Set file attributes

Syntax

setfile [ options ] file

Description

Sets attributes for one or more files. The options apply to all files listed. Options are:

-a flags

Sets or clears the file attributes. The flags string is composed of the characters listed below. Attributes that aren’t listed remain unchanged.

D = Destroy enable
N = Rename enable
B = Backup needed
I = Invisible
W = Write enable
R = Read enable

Uppercase letters set the attribute to 1; lowercase letters clear it to 0. For example,

setfile -a dnwbR Filename
Clears the Destroy, Rename, Write, and Backup bits, and sets the Read bit. This means that the file cannot be deleted, renamed, or written to, but it can be read from. The backup bit is also cleared, which tells backup programs that the file doesn’t need to be backed up.

-at type

Sets the auxilliary type. Type may be specified either in decimal or hexadecimal form. Hexadecimal numbers must be preceded by a ‘$’ character or “0x” character sequence.

-c date

Set the creation date. date is a string in one of the forms listed:

mm/dd/yy "mm/dd/yy hh:mm" "mm/dd/yy hh:mm AM" "mm/dd/yy hh:mm PM"
representing the month (1-12), day (1-31), year (0-99), hour (0-23), and minute (0-59). The string must be quoted if it contains a space. A period (.) indicates the current date and time.

-m date

Set the modification date. Date is the same format as for the -c option. A period (.) indicates the current date and time.

-t type

Sets the file type. Type may be specified as a decimal number, a hexadecimal number when preceded by a ‘$’ or “0x” character(s), or a 3-character filetype mnemonic.

-s size

Sets the file’s size in bytes. Size may be specified as a decimal number or a hexadecimal number when preceded by a ‘$’ or “0x” character(s).

Examples


setfile -a b -m \. foo.asm

Clears the backup-needed access attribute bit, and set’s the modification date to the current date and time on the file “foo.asm”. Note that the shell interprets a period as a reference to the current working directory, thus the backslash (\) is used to include the period for setfile.

setfile -m "07/03/90 02:25" mbox

Sets the modification date to July 3, 1990, and 02:25 A.M. on “mbox”. Note that the date string is quoted, since it contains a space, and that AM is assumed when the hour is less than 13 and no AM or PM is specified.

setfile Foo -t bin Bar -s 4096 Baz -at 0x4000

Operates on the files Foo, Bar, and Baz, setting their types to BIN ($06), auxiliary types to $4000, and their sizes to 4096 ($1000 or 0x1000) bytes. Note how filenames and options can be intermixed.

See Also

dstat(C), ls(C), sweep(C)