---
title: "removeItem(_:named:fromDirectory:replyHandler:)"
framework: fskit
role: symbol
role_heading: Instance Method
path: "fskit/fsvolume/operations/removeitem(_:named:fromdirectory:replyhandler:)"
---

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

Removes an existing item from a given directory.

## Declaration

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

```swift
func removeItem(_ item: FSItem, named name: FSFileName, fromDirectory directory: FSItem) async throws
```

## 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

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(_:replyHandler:).
