Attrib
Page updated January 21, 2005
Syntax
Parameters
Remarks
- Working with groups of files
You can use wildcard characters (that is, ? and *) with the FileName parameter to display or change the attributes for a group of files. If a file has the system or hidden attribute set, you must clear these attributes before you can change any other attributes for that file.
- Using the archive attribute
The archive attribute (that is, +a) marks files that have changed since the last time they were backed up. The xcopy command uses archive attributes. For more information about archive attributes and xcopy, see Related Topics.
- The attrib command, with different parameters, is available from the Recovery Console.
Examples
attrib news86
To assign the read-only attribute to the file named Report.txt, type:
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:
attrib -r b:\public\jones\*.* /s
Consider a scenario where 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. First, you need to set the archive attribute for all files on drive A. Second, you need to clear the archive attribute for those files with the .bak extension. For example, type:
attrib +a a:*.* attrib -a a:*.bak
Next, use xcopy to copy the files from the disk in drive A to the disk in drive B. The /a command-line option in the following command causes xcopy to copy only those files marked with the archive attribute. For example, type:
xcopy a: b: /a
xcopy a: b: /m
Formatting legend
Format | Meaning |
Italic | Information that the user must supply |
Bold | Elements that the user must type exactly as shown |
Ellipsis (...) | Parameter that can be repeated several times in a command line |
Between brackets ([]) | Optional items |
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one |
Courier font | Code or program output |
Some of these terms may be the same or similar to DOS commands. For information on DOS Commands, click here