A cross-platform and standard-compliant library for safe, recoverable file deletion. Move files and directories to your system’s trash rather than deleting them outright, and manage trashed items programmatically — all with one uniform API.
See the docs (and docstrings) for a detailed overview, but you can also just get
started by using trash
instead of rm
.
Most trashing libraries (particularly cross-platform ones) stop at sending items
to the trash; this library lets you inspect the trash (with Trash.list
),
retrieve (untrash
) or purge (Trash.purge
) entries from it, and more.
Library | Language | Library/CLI | Platforms | Trash | Untrash | List | Orphans | Purge | Empty |
---|---|---|---|---|---|---|---|---|---|
Trash.jl | Julia | 📚 | 🐧 🍏 🪟 | ✅️️ | ✅️ | ✅️ | ✅ | ✅ | ✅️ |
trash-rs | Rust | 📚 + 🐚 | 🐧 🍏 🪟 | ✅️ | ❌ | ❌ | ❌ | ❌ | ❌ |
send2trash | Python | 📚 | 🐧 🍏 🪟 | ✅️ | ❌ | ❌ | ❌ | ❌ | ❌ |
trash | JavaScript | 📚 + 🐚 | 🐧 🍏 🪟 | ✅️ | ❌ | ❌ | ❌ | ❌ | ❌ |
gomi | Go | 🐚 | 🐧 🍏 🪟 | ✅ | 🐧 | 🐧 | 🐧 | ❌ | ❌ |
Trashman | C# | 🐚 | 🐧 〰️️ 🪟 | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
trash-cli | Python | 🐚 | 🐧 〰️️ 〰️️ | ✅️ | ✅️ | ✅️ | ❌ | ✅ | ✅️ |
trash-d | D | 🐚 | 🐧 〰️️ 〰️️ | ✅️ | ✅️ | ✅️ | ✅ | ✅ | ✅️ |
GIO | C | 📚 | 🐧 〰️️ 〰️️ | ✅️ | ✅ | ✅ | ❌ | ❌ | ✅ |
KIO | C++ | 📚 | 🐧 〰️️ 〰️️ | ✅️ | ✅ | ❌ | ❌ | ❌ | ✅️ |
DS_Store parser | Python | 📚 | 〰️️ 🍏 〰️️ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ |
Foundation | ObjC/Swift | 📚 | 〰️️ 🍏 〰️️ | ✅️ | ❌ | ❌ | ❌ | ❌ | ❌ |
rifiuti2 | C | 🐚 | 〰️️ 〰️️ 🪟 | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ |
winshell | Python | 📚 | 〰️️ 〰️️ 🪟 | ✅️ | ✅️ | ✅️ | ❌ | ❌ | ✅️ |
win32 | C | 📚 | 〰️️ 〰️️ 🪟 | ✅️ | ❌ | ❌ | ❌ | ❌ | ✅️ |