4.2. Understanding File Attributes
Since the first versions of MS-DOS and the FAT file system (see Book II, Chapter 5), files have had some basic attributes. The following sections deal with only the attributes that a computer user will manage: namely, Read-only, Hidden, System, and Archive. The discussion focuses on the basic attributes, the extended attributes offered by Windows NTFS, and how to change the file attributes.
4.2.1. How attributes are stored
Attributes are stored as a single, 8-bit binary number. Because each bit can hold either a 0 or a 1, this yields 256 possible combinations of attributes — from eight 0s (no attributes applied; equal to 0 in decimal notation) to eight 1s (all attributes applied; equal to 255 in decimal notation).
Because each attribute holds a specific bit position, if several attributes are applied to a file, you can add the values (either binary or decimal) together to get a unique number that is 255 (11111111 in binary) or less for each unique combination of attributes. For example, if the file had the attributes of Read-only (1), System (4), and Archive (32), the value of the attribute byte would be 1 + 4 + 32, or 37. Only 37 (00100101 in binary) could represent a file with these attributes. The full list of attributes is listed in Table 4-9.
|Bit Position||Decimal Value||Binary Value||Attribute|