Folder attributes include none, H, HS, HSA, R, Ra, Rh, and RHA.
File attributes include a, Ra, RSA, and rhsa.
H-hide, S-system, R-read-only, and a-archive.
To change the properties of a file, use the DOS command.
For example, I create an O. txt file under drive G.
Then, I enter the DOS interface and go to the G-drive root directory.
Use the attrib + A + S + H o.txt command
The file o.txt has the HSA attribute.
Use the command> attrib-a-s-h o.txt
The file o.txt eliminates the HSA attributes.
Do not forget to mark the file after the command, otherwise it will operate on another file by default
Attrib --------------------------------------------------------------------------------
Display or modify attributes of a file.
This command displays, sets, or deletes the read-only, archive, system, and hidden attributes of a file or directory.
Syntax:
Attrib [+ R |-R] [+ A |-A] [+ S |-S] [+ H |-H] [[drive:] [path] filename] [/S]
To display all attributes of all files in the current directory, run the following command:
Attrib
Parameters:
[Drive:] [path] filename
Specifies the name of the file to be processed, the letter and Path Name of the drive.
Switch item:
+ R: Set read-only file attributes
-R: clears the read-only attribute of a file.
+ A. Set file archiving attributes.
-A: Clear the File Archive attributes.
+ S: Set the file to a system file.
-S: Clear System File Properties
+ H set the file to a hidden file
-H clear hidden file attributes
/S operations on the files in the current directory and all its subdirectories
Related commands:
For more information about copying files and directories with different attributes, see <xcopy>.
--------------------------------------------------------------------------------
Attrib-Annotation
Hide the combination of attributes and system attributes
If a file has both hidden and system attributes, you can use an attrib command to delete these attributes at the same time. For example, to delete the hidden and system attributes of the record. txt file, you can enter:
Attrib-s-h record. txt
Apply attrib to a group of Files
Use wildcards (? And *) to display and change the attributes of a group of files at the same time. If a file has a system or hidden attribute, you must clear it before changing other attributes of the file.
Change directory attributes
You can display or modify the directory attributes. Attrib is used for a directory. The directory name must be clearly specified, and wildcards cannot be used. For example, to hide the directory c: \ secret, enter the following command:
Attrib + H c: \ secret
The following command only applies to files and does not affect directories.
Attrib + h c :*.*
View archive attributes
Archive attribute (a) is used to mark the files changed after the last backup. These archive attributes are used by msbackup, restore, and xcopy commands. For more information about archive attributes, see:
<Msbackup>, <restore>, and <xcopy>
--------------------------------------------------------------------------------
Attrib-Example
Run the following command to display the file attributes named news86 on the current drive:
Attrib news86
Run the following command to assign the read-only attribute to the Report. txt file:
Attrib + R report.txt
Run the following command to delete the read-only attribute from the file attributes in the directory \ public \ Jones and Its subdirectories on disk B:
Attrib-r B: \ public \ Jones \ *. */s
In the last example, we assume that you want to operate all the files in the default directory of disk A (except for. BAK files ). Because <xcopy> is used to copy objects marked with the archive attribute, you need to set the archive attribute for the objects you want to copy. This can be done with the following two commands. It first sets the archive attribute for all files in drive a, and then deletes the archive attributes of files with the. Bak extension:
Attrib + :*.*
Attrib-A: *. Bak
Then, use the xcopy command to back up the file on disk A to disk B. The/a switch indicates that xcopy only backs up files with archive attributes:
Xcopy A: B:/
To delete the archive attribute of an object after each copy, you only need to switch/a to/M. For example:
Xcopy A: B:/m