<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/FileAttributeKey",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@T@NSFileAttributeKey"
  },
  "title" : "FileAttributeKey"
}
-->

# FileAttributeKey

Keys in dictionaries used to get and set file attributes.

```
struct FileAttributeKey
```

## Discussion

These keys are used with the methods listed in the Getting and Setting Attributes topic of [`FileManager`](/documentation/Foundation/FileManager).

## Topics

### Creating a File Attribute Key

[`init(_:)`](/documentation/Foundation/FileAttributeKey/init(_:))

Creates a file attribute key from a string.

[`init(rawValue:)`](/documentation/Foundation/FileAttributeKey/init(rawValue:))

Creates a file attribute key from a raw value string.

### Accessing File Attributes

[`appendOnly`](/documentation/Foundation/FileAttributeKey/appendOnly)

The key in a file attribute dictionary whose value indicates whether the file is read-only.

[`busy`](/documentation/Foundation/FileAttributeKey/busy)

The key in a file attribute dictionary whose value indicates whether the file is busy.

[`creationDate`](/documentation/Foundation/FileAttributeKey/creationDate)

The key in a file attribute dictionary whose value indicates the file’s creation date.

[`deviceIdentifier`](/documentation/Foundation/FileAttributeKey/deviceIdentifier)

The key in a file attribute dictionary whose value indicates the identifier for the device on which the file resides.

[`extensionHidden`](/documentation/Foundation/FileAttributeKey/extensionHidden)

The key in a file attribute dictionary whose value indicates whether the file’s extension is hidden.

[`groupOwnerAccountID`](/documentation/Foundation/FileAttributeKey/groupOwnerAccountID)

The key in a file attribute dictionary whose value indicates the file’s group ID.

[`groupOwnerAccountName`](/documentation/Foundation/FileAttributeKey/groupOwnerAccountName)

The key in a file attribute dictionary whose value indicates the group name of the file’s owner.

[`hfsCreatorCode`](/documentation/Foundation/FileAttributeKey/hfsCreatorCode)

The key in a file attribute dictionary whose value indicates the file’s HFS creator code.

[`hfsTypeCode`](/documentation/Foundation/FileAttributeKey/hfsTypeCode)

The key in a file attribute dictionary whose value indicates the file’s HFS type code.

[`immutable`](/documentation/Foundation/FileAttributeKey/immutable)

The key in a file attribute dictionary whose value indicates whether the file is mutable.

[`modificationDate`](/documentation/Foundation/FileAttributeKey/modificationDate)

The key in a file attribute dictionary whose value indicates the file’s last modified date.

[`ownerAccountID`](/documentation/Foundation/FileAttributeKey/ownerAccountID)

The key in a file attribute dictionary whose value indicates the file’s owner’s account ID.

[`ownerAccountName`](/documentation/Foundation/FileAttributeKey/ownerAccountName)

The key in a file attribute dictionary whose value indicates the name of the file’s owner.

[`posixPermissions`](/documentation/Foundation/FileAttributeKey/posixPermissions)

The key in a file attribute dictionary whose value indicates the file’s Posix permissions.

[`protectionKey`](/documentation/Foundation/FileAttributeKey/protectionKey)

The key in a file attribute dictionary whose value identifies the protection level for this file.

[`referenceCount`](/documentation/Foundation/FileAttributeKey/referenceCount)

The key in a file attribute dictionary whose value indicates the file’s reference count.

[`size`](/documentation/Foundation/FileAttributeKey/size)

The key in a file attribute dictionary whose value indicates the file’s size in bytes.

[`systemFileNumber`](/documentation/Foundation/FileAttributeKey/systemFileNumber)

The key in a file attribute dictionary whose value indicates the file’s filesystem file number.

[`systemFreeNodes`](/documentation/Foundation/FileAttributeKey/systemFreeNodes)

The key in a file system attribute dictionary whose value indicates the number of free nodes in the file system.

[`systemFreeSize`](/documentation/Foundation/FileAttributeKey/systemFreeSize)

The key in a file system attribute dictionary whose value indicates the amount of free space on the file system.

[`systemNodes`](/documentation/Foundation/FileAttributeKey/systemNodes)

The key in a file system attribute dictionary whose value indicates the number of nodes in the file system.

[`systemNumber`](/documentation/Foundation/FileAttributeKey/systemNumber)

The key in a file system attribute dictionary whose value indicates the filesystem number of the file system.

[`systemSize`](/documentation/Foundation/FileAttributeKey/systemSize)

The key in a file system attribute dictionary whose value indicates the size of the file system.

[`type`](/documentation/Foundation/FileAttributeKey/type)

The key in a file attribute dictionary whose value indicates the file’s type.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)