Lably
Skip to content

File attribute

  • 6 min read
  • 2 chapters

Related on Lably

Through File system, Volume (computing) and DOS

DOS and Windows

Traditionally, in DOS and Microsoft Windows, files and folders accepted four attributes:

  • Archive (A): When set, it indicates that the hosting file has changed since the last backup operation. Windows' file system sets this attribute on any file that has changed. Backup software then has the duty of clearing it upon a successful full or incremental backup (not a differential one).
  • Hidden (H): When set, indicates that the hosting file is hidden. MS-DOS commands like dir and Windows apps like File Explorer do not show hidden files by default, unless asked to do so.
  • System (S): When set, indicates that the hosting file is a critical system file that is necessary for the computer to operate properly. MS-DOS and Microsoft Windows use it to mark important system files. MS-DOS commands like dir and Windows apps like File Explorer do not show system files by default even when hidden files are shown, unless asked to do so.
  • Read-only (R): When set, indicates that a file should not be altered. Upon opening the file, file system API usually does not grant write permission to the requesting application, unless the application explicitly requests it. Read-only attributes on folders are usually ignored, being used for another purpose.

As new versions of Windows came out, Microsoft has added to the inventory of available attributes on the NTFS file system, including but not limited to:

  • Compressed (C): When set, Windows compresses the hosting file upon storage. For more information, see NTFS § File compression.
  • Encrypted (E): When set, Windows encrypts the hosting file upon storage to prevent unauthorized access. For more information, see NTFS § Encryption.
  • Not Content-Indexed (I): When set, Indexing Service or Windows Search do not include the hosting file in their indexing operation.

Other attributes that are displayed in the "Attributes" column of Windows Explorer include:

  • Directory (D): The entry is a subdirectory, containing file and directory entries of its own.
  • Reparse Point (L): The file or directory has an associated re-parse point, or is a symbolic link.
  • Offline (O): The file data is physically moved to offline storage (Remote Storage).
  • Sparse (P): The file is a sparse file, i.e., its contents are partially empty and non-contiguous.
  • Temporary (T): The file is used for temporary storage.

In DOS, OS/2 and Windows, the attrib command in cmd.exe and command.com can be used to change and display the four traditional file attributes. File Explorer in Windows can show the seven mentioned attributes but cannot set or clear the System attribute. Windows PowerShell, which has become a component of Windows 7 and later, features two commands that can read and write attributes: Get-ItemProperty and Set-ItemProperty. To change an attribute on a file on Windows NT, the user must have appropriate file system permissions known as Write Attributes and Write Extended Attributes.

Sign in to keep reading

One more chapter is free with a Lably account.

More in Computer Science