Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

FileAttributes (Enums)
 
.
Summary
The file attributes used by file-handling functions, such as those of shlwapi.dll.

C# Definition:

/// <summary>
/// File attributes are metadata values stored by the file system on disk and are used by the system and are available to developers via various file I/O APIs.
/// </summary>
[Flags]
[CLSCompliant(false)]
enum FileAttributes : uint
{
     /// <summary>
     /// A file that is read-only. Applications can read the file, but cannot write to it or delete it. This attribute is not honored on directories. For more information, see "You cannot view or change the Read-only or the System attributes of folders in Windows Server 2003, in Windows XP, or in Windows Vista".
     /// </summary>
     Readonly = 0x00000001,

     /// <summary>
     /// The file or directory is hidden. It is not included in an ordinary directory listing.
     /// </summary>
     Hidden = 0x00000002,

     /// <summary>
     /// A file or directory that the operating system uses a part of, or uses exclusively.
     /// </summary>
     System = 0x00000004,

     /// <summary>
     /// The handle that identifies a directory.
     /// </summary>
     Directory = 0x00000010,

     /// <summary>
     /// A file or directory that is an archive file or directory. Applications typically use this attribute to mark files for backup or removal.
     /// </summary>
     Archive = 0x00000020,

     /// <summary>
     /// This value is reserved for system use.
     /// </summary>
     Device = 0x00000040,

     /// <summary>
     /// A file that does not have other attributes set. This attribute is valid only when used alone.
     /// </summary>
     Normal = 0x00000080,

     /// <summary>
     /// A file that is being used for temporary storage. File systems avoid writing data back to mass storage if sufficient cache memory is available, because typically, an application deletes a temporary file after the handle is closed. In that scenario, the system can entirely avoid writing the data. Otherwise, the data is written after the handle is closed.
     /// </summary>
     Temporary = 0x00000100,

     /// <summary>
     /// A file that is a sparse file.
     /// </summary>
     SparseFile = 0x00000200,

     /// <summary>
     /// A file or directory that has an associated reparse point, or a file that is a symbolic link.
     /// </summary>
     ReparsePoint = 0x00000400,

     /// <summary>
     /// A file or directory that is compressed. For a file, all of the data in the file is compressed. For a directory, compression is the default for newly created files and subdirectories.
     /// </summary>
     Compressed = 0x00000800,

     /// <summary>
     /// The data of a file is not available immediately. This attribute indicates that the file data is physically moved to offline storage. This attribute is used by Remote Storage, which is the hierarchical storage management software. Applications should not arbitrarily change this attribute.
     /// </summary>
     Offline = 0x00001000,

     /// <summary>
     /// The file or directory is not to be indexed by the content indexing service.
     /// </summary>
     NotContentIndexed = 0x00002000,

     /// <summary>
     /// A file or directory that is encrypted. For a file, all data streams in the file are encrypted. For a directory, encryption is the default for newly created files and subdirectories.
     /// </summary>
     Encrypted = 0x00004000,

     /// <summary>
     /// This value is reserved for system use.
     /// </summary>
     Virtual = 0x00010000
}

VB Definition:

    ''' <summary>
    ''' File attributes are metadata values stored by the file system on disk and are used by the system and are available to developers via various file I/O APIs.
    ''' </summary>
    <Flags> _
    <CLSCompliant(False)> _
    Enum FileAttributes As UInteger
    ''' <summary>
    ''' A file that is read-only. Applications can read the file, but cannot write to it or delete it. This attribute is not honored on directories. For more information, see "You cannot view or change the Read-only or the System attributes of folders in Windows Server 2003, in Windows XP, or in Windows Vista".
    ''' </summary>
    [Readonly] = &H1

    ''' <summary>
    ''' The file or directory is hidden. It is not included in an ordinary directory listing.
    ''' </summary>
    Hidden = &H2

    ''' <summary>
    ''' A file or directory that the operating system uses a part of, or uses exclusively.
    ''' </summary>
    System = &H4

    ''' <summary>
    ''' The handle that identifies a directory.
    ''' </summary>
    Directory = &H10

    ''' <summary>
    ''' A file or directory that is an archive file or directory. Applications typically use this attribute to mark files for backup or removal.
    ''' </summary>
    Archive = &H20

    ''' <summary>
    ''' This value is reserved for system use.
    ''' </summary>
    Device = &H40

    ''' <summary>
    ''' A file that does not have other attributes set. This attribute is valid only when used alone.
    ''' </summary>
    Normal = &H80

    ''' <summary>
    ''' A file that is being used for temporary storage. File systems avoid writing data back to mass storage if sufficient cache memory is available, because typically, an application deletes a temporary file after the handle is closed. In that scenario, the system can entirely avoid writing the data. Otherwise, the data is written after the handle is closed.
    ''' </summary>
    Temporary = &H100

    ''' <summary>
    ''' A file that is a sparse file.
    ''' </summary>
    SparseFile = &H200

    ''' <summary>
    ''' A file or directory that has an associated reparse point, or a file that is a symbolic link.
    ''' </summary>
    ReparsePoint = &H400

    ''' <summary>
    ''' A file or directory that is compressed. For a file, all of the data in the file is compressed. For a directory, compression is the default for newly created files and subdirectories.
    ''' </summary>
    Compressed = &H800

    ''' <summary>
    ''' The data of a file is not available immediately. This attribute indicates that the file data is physically moved to offline storage. This attribute is used by Remote Storage, which is the hierarchical storage management software. Applications should not arbitrarily change this attribute.
    ''' </summary>
    Offline = &H1000

    ''' <summary>
    ''' The file or directory is not to be indexed by the content indexing service.
    ''' </summary>
    NotContentIndexed = &H2000

    ''' <summary>
    ''' A file or directory that is encrypted. For a file, all data streams in the file are encrypted. For a directory, encryption is the default for newly created files and subdirectories.
    ''' </summary>
    Encrypted = &H4000

    ''' <summary>
    ''' This value is reserved for system use.
    ''' </summary>
    Virtual = &H10000
    End Enum

Alternative Managed API:

System.IO.FileAttributes

Notes:

None.

Documentation
 

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it!

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions