---
title: "trashItem(at:resultingItemURL:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/filemanager/trashitem(at:resultingitemurl:)"
---

# trashItem(at:resultingItemURL:)

Moves an item to the trash.

## Declaration

```swift
func trashItem(at url: URL, resultingItemURL outResultingURL: AutoreleasingUnsafeMutablePointer<NSURL?>?) throws
```

## Parameters

- `url`: The item to move to the trash.
- `outResultingURL`: On input, a pointer to a URL object. On output, this pointer is set to the item’s location in the trash. The actual name of the item may be changed when moving it to the trash, so use this URL to access it. You may specify nil for this parameter if you do not want the information.

## See Also

### Creating and deleting items

- [createDirectory(at:withIntermediateDirectories:attributes:)](foundation/filemanager/createdirectory(at:withintermediatedirectories:attributes:).md)
- [createDirectory(atPath:withIntermediateDirectories:attributes:)](foundation/filemanager/createdirectory(atpath:withintermediatedirectories:attributes:).md)
- [createFile(atPath:contents:attributes:)](foundation/filemanager/createfile(atpath:contents:attributes:).md)
- [removeItem(at:)](foundation/filemanager/removeitem(at:).md)
- [removeItem(atPath:)](foundation/filemanager/removeitem(atpath:).md)
