help.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
ATTRIB--Examples
Syntax  Notes
────────────────────────────────────────────────────────────────────────────
 
                              ATTRIB──Examples
 
To display the attributes of a file named NEWS86 located on the current
drive, type the following command:
 
    attrib news86
 
To assign the Read-Only attribute to the file REPORT.TXT, type the following
command:
 
    attrib +r report.txt
 
To remove the Read-Only attribute from files in the \PUBLIC\JONES directory
on a disk in drive B and from files in any subdirectories of \PUBLIC\JONES,
type the following command:
 
    attrib -r b:\public\jones\*.* /s
 
As a final example, suppose you want to give an associate a disk containing
all files in the default directory on a disk in drive A except files with
the .BAK extension. Because you can use <XCOPY> to copy only those files
marked with the Archive attribute, you need to set the Archive attribute for
those files you want to copy. To do this, you would use the following two
commands to set the Archive attribute for all files on drive A and then to
clear the attribute for those files with the .BAK extension:
 
    attrib +a a:*.*
 
    attrib -a a:*.bak
 
Next, use the XCOPY command to copy the files from the disk in drive A to
the disk in drive B. The /A switch in the following command causes XCOPY to
copy only those files marked with the Archive attribute:
 
    xcopy a: b: /a
 
If you want XCOPY to clear each file's Archive attribute after it copies the
file, use the /M switch instead of /A, as in the following example:
 
    xcopy a: b: /m
 
                                      ♦