Understanding File Attributes
Since the first versions of MS-DOS and the FAT file system, files have had some basic attributes. The following sections deal with only the attributes that a user of a computer will manage, which are Read-only, Hidden, System, and Archive. The discussion focuses on the basic attributes, the extended attributes offered by Windows 2000 and Windows XP NTFS, and how to change the file attributes.
Working with the Volume Label
In addition to these four basic attributes, one more attribute, Volume, is usually set on your hard drive. The Volume attribute is usually applied to only one directory entry per drive (excluding the directory entries that are used for long filename entries) and stores the volume label for the drive. The directory entry that contains the label can be modified through one of the following methods:
- By using the label command at a command prompt
- By editing the Label field in the Properties window of your drive
- By using the Rename command in the My Computer window (Windows 2000 and Windows XP only)
How attributes are stored
Attributes are stored as a single 8-bit binary number. Because each bit can hold either a 0 or 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), then 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 below.
File AttributesBit position | Decimal Value | Binary Value | Attribute |
---|---|---|---|
1 | 1 | 00000001 | Read-only |
2 | 2 | 00000010 | Hidden |
3 | 4 | 00000100 | System |
4 | 8 | 00001000 | Volume Label |
5 | 16 | 00010000 | Subdirectory |
6 | 32 | 00100000 | Archive |
7 | 64 | 01000000 | Unused |
8 | 128 | 10000000 | Unused |
In this tutorial:
- Managing Files and Directories
- Identifying File-Naming Conventions
- Long and short filenames
- Creating file associations
- Understanding file extensions
- Compression utilities Extensions
- Graphic files Extensions
- Understanding File Attributes
- The basic attributes
- Windows 2000 and Windows XP extended attributes
- Encrypt
- Index
- Setting basic attributes