FileAttributes FileAttributes FileAttributes FileAttributes FileAttributes Enum


Describes the attributes of a file or folder.

This enumeration has a System.FlagsAttribute attribute that allows a bitwise combination of its member values.

public : enum class FileAttributes
enum class winrt::Windows::Storage::FileAttributes : uint32_t
public enum FileAttributes
Public Enum FileAttributes
var value = Windows.Storage.FileAttributes.archive;
System.FlagsAttribute ContractVersionAttribute

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


Archive Archive Archive Archive Archive 32

The item is archived.

Directory Directory Directory Directory Directory 16

The item is a directory.

LocallyIncomplete LocallyIncomplete LocallyIncomplete LocallyIncomplete LocallyIncomplete 512

The item is locally incomplete. Windows only.

Normal Normal Normal Normal Normal 0

The item is normal. That is, the item doesn't have any of the other values in the enumeration.

ReadOnly ReadOnly ReadOnly ReadOnly ReadOnly 1

The item is read-only.

Temporary Temporary Temporary Temporary Temporary 256

The item is a temporary file.


The following example shows how to check the attributes of a folder.

using Windows.Storage;
using System.Diagnostics; // For writing results to the Output window.

// Get the app's installation folder.
StorageFolder appFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;

// Get the folder's attributes.
FileAttributes folderAttributes = appFolder.Attributes;

// Check the folder's attributes.
// Write the results to the Visual Studio Output window.
if ((folderAttributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
    Debug.WriteLine("The item is read-only.");

if ((folderAttributes & FileAttributes.Directory) == FileAttributes.Directory)
    Debug.WriteLine("The item is a folder.");

if ((folderAttributes & FileAttributes.Archive) == FileAttributes.Archive)
    Debug.WriteLine("The item is archived.");

if ((folderAttributes & FileAttributes.Temporary) == FileAttributes.Temporary)
    Debug.WriteLine("The item is temporary.");


The FileAttributes enumeration is used with the StorageFile.Attributes and StorageFolder.Attributes properties.

The enumeration values match the Win32 file type attributes. Therefore the enumeration values correspond to the Win32 values, which are flags in base 2.