What is a File Attribute?

List of File Attributes in Windows

Illustration of a man checking off a series of checkboxes
© yuoak / DigitalVision Vectors / Getty Images

A file attribute (often just referred to as an attribute or a flag) is a specific condition in which a file or directory can exist.

An attribute is considered either set or cleared at any given time, which means it's either enabled or isn't.

Computer operating systems, like Windows, can tag data with specific file attributes so that data can be treated differently than data with an attribute turned off.

Files and folders aren't actually changed when attributes are applied or removed, they're just understood differently by the operating system and other software.

What Are the Different File Attributes?

A number of file attributes exist in Windows, including the following:

The following file attributes were first available to the Windows operating system with the NTFS file system, meaning they aren't available in the older FAT file system:

Here are several additional, albeit more rare, file attributes recognized by Windows:

  • Device file attribute
  • Integrity file attribute
  • Not content indexed file attribute
  • No scrub file attribute
  • Offline file attribute
  • Sparse file attribute
  • Temporary file attribute
  • Virtual file attribute

    You can read more about these on this MSDN page on Microsoft's site.

    Note: Technically there's also a normal file attribute, implying no file attribute at all, but you'll never see this actually referenced anywhere within your normal Windows use.

    Why Are File Attributes Used?

    File attributes exist so that you, or a program you're using, or even the operating system itself, can be granted or denied particular rights to a file or folder.

    Learning about common file attributes can help you understand why certain files and folders are referred to as "hidden" or "read-only," for example, and why interacting with them is so different than interacting with other data.

    Applying the read-only file attribute to a file will prevent it from being edited or changed in any way unless the attribute is lifted to allow write access. The read-only attribute is often used with system files that shouldn't be altered, but you could do the same with your own files that you'd rather someone with access not edit.

    Files with the hidden attribute set will actually be hidden from normal views, making these files really difficult to accidentally delete, move, or change. The file still exists like every other file, but because the hidden file attribute is toggled, it prevents the casual user from interacting with it.

    File Attributes vs Folder Attributes

    Attributes can be toggled on and off for both files and folders, but the consequences of doing so differ a bit between the two.

    When a file attribute like the hidden attribute is toggled on for a file, that single file will be hidden - nothing else.

    If the same hidden attribute is applied to a folder, you're given more options than to just hide the folder: you have the option to apply the hidden attribute to the folder alone or to the folder, its subfolders, and all of its files.

    Applying the hidden file attribute to a folder's subfolders and its files means that even after you open the folder, all the files and folders that are contained within it will be hidden as well. The first option of just hiding the folder alone would make the subfolders and files visible, but just hide the main, root area of the folder.

    How File Attributes Are Applied

    Although all of the available attributes for a file have common names, which you saw in the lists above, they aren't all applied to a file or folder in the same way.

    A small selection of attributes can be turned on manually. In Windows, you can do this by right-clicking or tap-and-holding a file or folder and then enabling or disabling an attribute from the list provided.

    In Windows, a larger selection of attributes can also be set with the attrib command, available from Control Panel. Having attribute control via a command allows third-party programs, like backup software, to easily edit file attributes.

    Linux operating systems can use the chattr (Change Attribute) command to set file attributes, while chflags (Change Flags) is used on Mac OS X.

    More From Us