ATTRIB ATTRIB
Name
attrib - sets or resets the read-only attribute of a file,
or displays the attributes of a file
Syntax
attrib [+R|-R] [+A|-A] [d:] [path]filename[.ext] [/S]
Description
If an application opens a file with read and write permis-
sion, attrib forces read-only mode to allow file sharing
over a network.
+r sets the read-only attribute of a file.
-r disables read-only mode.
+a sets the archive attribute of a file.
-a clears the archive attribute of a file.
[drive:] pathname
specifies the name of the drive and the full pathname of
the file you want to reference.
/S makes attrib search through all files and all subdirec-
tories.
The backup, restore, and xcopy (mcopy) commands use the
archive attribute to control a selective
backup/restore/xcopy on files that have been modified. You
can use the +a and -a options to select files that you want
to back up with the backup /m switch, or copy with the xcopy
(or mcopy) /m or /a switches.
To display the attribute of a specific file on the default
drive, enter attrib followed by the pathname of the file.
To print the attributes of all files in a specific direc-
tory, use the wildcard abbreviation *.* in the pathname.
Examples
The following example gives the file report.txt read-only
permission:
attrib +r report.txt
Suppose you want to use xcopy to copy all the files in the
default directory of drive A, except for those that have an
extension of .bak, to drive B. You would enter the follow-
ing:
attrib +a a:*.*
attrib -a a:*.bak
and:
xcopy a: b: /m
or:
copy a: b: /a
If you use the /m switch, xcopy automatically turns off the
archive bits of the files in drive A as it copies them.
Notes
attrib is an external command.
ATTRIB (printed 8/16/89) ATTRIB