AmigaOS 3.1 Command Reference

PROTECT


Format:
PROTECT [FILE] <file|pattern> [FLAGS][+|-]
[<flags>] [ADD|SUB] [ALL] [QUIET]

Template:
FILE/A, FLAGS, ADD/S, SUB/S, ALL/S, QUIET/S

Purpose:
To change the protection bits of a file.

Path:
C:PROTECT

Specification:


All files have a series of protection bits stored with them which control
their attributes. These bits can be altered to indicate the type of file and
the file operations permitted. PROTECT is used to set or clear the
protection bits of a file.

The protection bits are represented by letters:

s The file is a script.
p The file is a pure command and can be made resident.
a The file has been archived.
r The file can be read.
w The file can be written to (altered).
e The file is executable (a program).
d The file can be deleted.

To see the protection bits associated with a file, use the LIST command. The
protection field is displayed with set (on) bits shown by their letters and
clear (off) bits shown by hyphens. For example, a fle that is readable,
writeable and deletable, will have ----rw-d in the protection feld.

To specify the entire protection field at once, give the letters of the bits
you want set as the FLAGS argument, without any other keywords. The named
bits will be set, and all the others will be cleared.

The symbols + and - (or the equivalent keywords ADD and SUB) are used to
control specific bits without affecting the state of unspecified bits.
Follow + or - with the letters ofthe bit(s) to set or clear, respectively,
and only those bits will be changed. Don't put a space after the symbol or
between the letters. The order ofthe letters does not matter. ADD and SUB
work similarly, but there must be a space between the keyword and the
letters. You cannot both set and clear bits in the same command.

The ALL option adds or removes the specified protection bits from all the
files in the specified directory. The QUIET option suppresses the screen
output.

Example 1:

1> PROTECT DF0:Memo +rw

Sets only the protection bits r (readable) and w (writeable) to the file
Memo on DF0:. No other protection bits are changed.

Example 2:

1> PROTECT L:#? e SUB

Clears the e (executable) protection bit from all the files in the L:
directory.

Example 3:

1> PROTECT Work:Paint rwed

The protection status of Paint becomes "----rwed".

See also:

LIST


Converted from AmigaGuide to HTML by Jaruzel