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

# lookupItem(named:inDirectory:replyHandler:)

Looks up an item within a directory.

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

## Parameters

`name`

The name of the item to look up.

`directory`

The directory in which to look up the item.

`reply`

A block or closure to indicate success or failure. If lookup succeeds, pass the found [`FSItem`](/documentation/FSKit/FSItem) and its [`FSFileName`](/documentation/FSKit/FSFileName) (as saved within the file system), along with a `nil` error. If lookup fails, pass the relevant error as the third parameter; any [`FSItem`](/documentation/FSKit/FSItem) or [`FSFileName`](/documentation/FSKit/FSFileName) are ignored in this case. For an `async` Swift implementation, there’s no reply handler; simply return the [`FSItem`](/documentation/FSKit/FSItem) and [`FSFileName`](/documentation/FSKit/FSFileName) as a tuple 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)