(redirected from DOS Attrib)
Also found in: Dictionary.


An external command in DOS and Windows that displays and changes the attribute settings in every file. The A, H, R and S bits are 1=yes and 0=no.
File Attributes
     A - Archived (backed up?)
     H - Hidden file
     R - Read only
     S - System file

To display the current attributes in all files in the current folder, type:
attrib *.*     files only
    attrib *.* /s  files & subfolders

When a file is read-only, it cannot be changed or deleted. To set and reset VITAL.TXT, type:
attrib vital.txt +r   set to read-only
 attrib vital.txt -r   reset to read/write

New files are set to archive status (archive bit is on). When files are copied by the Xcopy command, the archive bit is turned off (0) on the original file and not turned on again (1) until the file has been modified by some application. The following example removes and restores the archive status in XYZ.TXT.
attrib xyz.txt -a   turn off
   attrib xyz.txt +a   turn back on

To back up only modified files, the /m switch is used with the Xcopy command. After copying, the archive bit on the original file is turned off (set to zero). For example, to Xcopy only modified files to the BACKUP folder in drive D, type the following (for more examples, see Xcopy).
xcopy *.* d:\backup /m

These attributes are assigned to operating system files and some files that applications generate. As a rule, users do not tamper with them.
attrib xyz +s   make XYZ a system file
 attrib xyz -s   clear system file status

 attrib xyz +h   make XYZ a hidden file
 attrib xyz -h   clear hidden status