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 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
More Information About Attrib
Attrib--Notes
Attrib