Each file is stored in a directory, and uses a directory entry that describes its characteristics such as its name, file extension and size. The directory entry also contains a pointer to where the file is physically stored on disk. In addition, one of the characteristics stored for each file is a set of file attributes that give the operating system, as well as application software, additional information about the file and how it should be used.
While the use of attributes is strictly “voluntary”, they are important in certain circumstances. Operating systems, as well as application software, based upon a specific action to be taken, customarily look at files as well as their attributes in an effort to discern how the file should treated. As an example, a file management programs such as Windows Explorer determines the attributes of a file in an effort to warn you that it may be a system file, a read-only file, or that it has a hidden attributes. Certain cheap programs will, for the large part, delete files, move them and even overwrite them at will with no warning what so ever.
Most operating systems assign finite meanings to the attributes assigned to files, and the operating system will alter its behavior accordingly. If at a DOS prompt you type “DIR” to list the files in the directory, by default you will not see any files that have the “hidden” attribute set. You have to type “DIR /AH” to see the hidden files. Likewise, while in Windows Explorer, you cannot view hidden files without first changing the Windows Explorer view in the options section.
While a file can have more than one attribute, there are only a few that are usable and that make sense, at least to your operating system. Attributes are stored in a single byte, with each bit of the byte representing a specific attribute. Only six of the eight bits are used, which are listed immediately below. Each bit that is actually set or attached to a file means that the file has that attribute turned on. These are frequently referred to as attribute bits or attribute flags.
The following are the attributes and the bits they use in the attribute byte:
The value of each of the attribute bits are totaled to form the value of the attribute byte. Following this precept, an attribute byte for a hidden, read-only file would be 00000011, while the attribute byte for a hidden, read-only directory would be 00010011. If a file were to be given “Read-Only”, “Hidden” and “System” attributes, the byte code would be 00000111. While most of these attribute tags are self-explanatory, let’s go into a little more detail about each one.
Each of the attribute tags apply equally to files and directories, except for the directory attribute itself.
Data can be read from or written to the file.
Most current operating systems, Windows® 95 through Windows® XP, when requested to either move, change or delete a file marked read-only, will refuse. Even earlier versions of DOS and MS-DOS®, when asked to move, change or delete a file marked read-only reply with an “Access Denied” message. Although some will say that Windows® Explorer will be most happy to accommodate you, and move, change or delete such a file, we disagree. Remember, Windows® Explorer isn’t completing the delete operation when you initially delete a file, it moves it to the Recycle Bin. If you try and move a read-only file, it will ask you if this is what you want to do.
Although this attribute is self-explanatory, when a file is marked hidden, under normal circumstances it is hidden from view entirely, even in Windows. DOS and MS-DOS® will not display the file when you type directory command unless a special flag is used, such as DIR /H.
This flag is used to tag important files that are used by the system exclusively and should not be altered or removed from the system. Essentially, this is similar to a read-only flag, however its attribute notifies you that it is system exclusive.
When partitioning and formatting a hard drive, you can assign an identifying label to the disk volume (the partition), either during the format process, or later through the use disk tools such as the DOS command “LABEL”. The volume label is stored in the root directory as a file entry with the “Volume Label” attribute set.
This attribute is unlike all of the others, in that it is the bit that differentiates between entries that describe files and those that describe subdirectories within the current directory.
A file’s archive bit is a marker that indicates whether the file had been changed or modified. An archive bit that is set, or turned on, indicates that the file has changed since it was last backed up or copied. The question is often asked, why turn off a file’s archive bit? Turning off or resetting the file’s archive bit is a procedure that affects what a backup program will back up or copy the next time it is used. An archive bit that is off indicates to the backup program that a specific file has not changed since it was last backed up. Most better backup programs allow you to select the backup method. such as backing up or copy all files, or only those files whose archive bit is on. This will also allow you to determine whether the backup program will turn off the archive bit after the file has been backed up or copied.
A file’s archive bit can also be turned on and off by other applications.
Notice: Windows® 95, Windows® 98, Windows® NT, Windows® 2000, Windows® XP and Microsoft® Office are registered trademarks or trademarks of the Microsoft Corporation.
All other trademarks are the property of their respective owners.