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

# removeItem(_:named:fromDirectory:replyHandler:)

Removes an existing item from a given directory.

```
func removeItem(_ item: FSItem, named name: FSFileName, fromDirectory directory: FSItem, replyHandler reply: @escaping @Sendable ((any Error)?) -> Void)
```

## Parameters

`item`

The item to remove.

`name`

The name of the item to remove.

`directory`

The directory from which to remove the item.

`reply`

A block or closure to indicate success or failure. If removal fails, pass an error as the one parameter to the reply handler. If removal succeeds, pass `nil`. For an `async` Swift implementation, there’s no reply handler; simply throw an error or return normally.

## Discussion

Don’t actually remove the item object itself in your implementation; instead, only remove the given item name from the given directory.
Remove and deallocate the item in `reclaimItem(_:)`.

---

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)