<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSVolume/Handler/lookupItem(named:in:context:replyHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "FSKit"
    ],
    "preciseIdentifier" : "c:objc(pl)FSVolumeHandler(im)lookupItemNamed:inDirectory:context:replyHandler:"
  },
  "title" : "lookupItem(named:in:context:replyHandler:)"
}
-->

# lookupItem(named:in:context:replyHandler:)

Looks up an item within a directory.

```
func lookupItem(named name: FSFileName, in directory: FSItem, context: FSContext, replyHandler reply: @escaping @Sendable (FSLookupItemResult?, (any Error)?) -> Void)
```

## Parameters

`name`

The name of the item to look up.

`directory`

The directory in which to look up the item.

`context`

An object that enables context-aware file system decisions throughout the operation.

`reply`

A block or closure to indicate success or failure. If lookup succeeds, pass an instance of [`FSLookupItemResult`](/documentation/FSKit/FSLookupItemResult) containing the found [`FSItem`](/documentation/FSKit/FSItem), its [`FSFileName`](/documentation/FSKit/FSFileName) (as saved within the file system), and its [`FSItem.Attributes`](/documentation/FSKit/FSItem/Attributes), along with a `nil` error. If lookup fails, pass the relevant error as the second parameter; FSKit ignores the [`FSLookupItemResult`](/documentation/FSKit/FSLookupItemResult) instance in this case. For an `async` Swift implementation, there’s no reply handler; simply return the result instance or throw an error.

## Discussion

If no item matching `name` exists in the directory indicated by `directory`, complete the request with an error with a domain of <doc://com.apple.documentation/documentation/Foundation/NSPOSIXErrorDomain> and a code of `ENOENT`.

> Tip: The ``doc://FSKit/documentation/FSKit/FSFileName`` sent back to the caller may differ from the `name` parameter. This flexibility allows your implementation to handle case-insensitive and case-sensitive file systems. It might also be the case that `name` uses a composed Unicode string, but the name maintained by the file system and provided to the caller is uncomposed Unicode.

---

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)