MSDN Documentation – Windows

File Attributes

File attributes are metadata flags that describe the state and behavior of files and directories in the Windows operating system. They are stored in the file system and can be read or modified programmatically.

Attribute Value (Hex) Description
ReadOnly0x00000001Prevents write operations on the file.
Hidden0x00000002File is not visible in standard directory listings.
System0x00000004File is used by the operating system.
Directory0x00000010Entry is a directory.
Archive0x00000020File has changed since the last backup.
Device0x00000040Reserved for system use.
Normal0x00000080No other attributes are set.
Temporary0x00000100File is temporary and may be deleted soon.
SparseFile0x00000200File is a sparse file.
ReparsePoint0x00000400File contains a reparse point.
Compressed0x00000800File is compressed.
Offline0x00001000Data is not immediately available.
NotContentIndexed0x00002000File is excluded from indexing.
Encrypted0x00004000File is encrypted.
IntegrityStream0x00008000File has integrity metadata.
Virtual0x00010000File is a virtual (non-disk) file.
NoScrubData0x00020000File is exempt from data scrubbing.

Getting File Attributes in C#

using System;
using System.IO;

class Program
{
    static void Main()
    {
        string path = @"C:\Temp\example.txt";
        FileAttributes attrs = File.GetAttributes(path);
        Console.WriteLine($""Attributes for {path}: {attrs}"");
        if ((attrs & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
        {
            Console.WriteLine(""File is read‑only"");
        }
    }
}

Getting File Attributes in C++ (WinAPI)

For a complete reference, see the File Attribute Functions page.