Skip to main content

Send2Trash – Send files to trash on all platforms

Send2Trash is a small package that sends files to the Trash (or Recycle Bin) natively and on all platforms. On OS X, it uses native FSMoveObjectToTrashSync Cocoa calls or can use pyobjc with NSFileManager. On Windows, it uses native IFileOperation call if on Vista or newer and pywin32 is installed or falls back to SHFileOperation calls. On other platforms, if PyGObject and GIO are available, it will use this. Otherwise, it will fallback to its own implementation of the trash specifications from freedesktop.org.

ctypes is used to access native libraries, so no compilation is necessary.

Send2Trash supports Python 3 (versions before 2.x support Python 2).

Status: Additional Help Welcome

Additional help is welcome for supporting this package. Specifically help with the OSX and Linux issues and fixes would be most appreciated.

Installation

You can download it with pip:

python -m pip install -U send2trash

To install with pywin32 or pyobjc required specify the extra nativeLib:

python -m pip install -U send2trash[nativeLib]

or download the source from https://github.com/arsenetar/send2trash and install it with:

python -m pip install -e .

On systems where Python enforces PEP 668 (e.g., recent Linux distributions), installing packages into the system Python may be restricted. Use a virtual environment:

python -m venv .venv

GNU/Linux / macOS:

source .venv/bin/activate

Windows:

.venvScriptsactivate

Usage

>>> from send2trash import send2trash
>>> send2trash('some_file')
>>> send2trash(['some_file1', 'some_file2'])

On Freedesktop platforms (Linux, BSD, etc.), you may not be able to efficiently trash some files. In these cases, an exception send2trash.TrashPermissionError is raised, so that the application can handle this case. This inherits from PermissionError. Specifically, this affects files on a different device to the user’s home directory, where the root of the device does not have a .Trash directory, and we don’t have permission to create a .Trash-$UID directory.

For any other problem, OSError is raised.

Metadata

Release files for Send2Trash 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Send2Trash 2.2.0
File Size Uploaded Provenance Actions
send2trash-2.2.0.tar.gz 19.7 kB With provenance Details for send2trash-2.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Send2Trash 2.2.0
File Interpreter ABI Platform Actions
send2trash-2.2.0-py3-none-any.whl Python 3 none any Details for send2trash-2.2.0-py3-none-any.whl

Total release size: 37.1 kB

Release files / send2trash-2.2.0.tar.gz

Download URL send2trash-2.2.0.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e0ac412073f7984288908d9d8b8d13c82be69a615bb513d948fa2f053447970a
BLAKE2b-256 checksum
How to use checksums
aa9c41c11853a5fb67b4639993a628182d326ffe4327eb28a125d202fb49950f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / send2trash-2.2.0-py3-none-any.whl

Download URL send2trash-2.2.0-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f540296d59744fbf2f88b0d6f3a484af78c94d3c20e0875a4d5eed61aef037c
BLAKE2b-256 checksum
How to use checksums
b2de7a9e77bd4c5f6eb11d90eb75807c1e1f0ea54997b05ae86d6fc5fa080c04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for Send2Trash 2.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for send2trash-2.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page