a high level api for handling recycle bins across platforms
Project description
pytrash
a high level api for handling recycle bins across platforms
Installation
uv add pytrash
Usage
import pytrash
# pytrash provides a way to move files to the bin, list entries in bin, and restore files from bin.
# create instance of Bin
bin = pytrash.RecycleBin()
# move a file to the bin
bin.recycle(["path/to/file.txt"])
# list entries
bin.entries()
# restore a file from the bin
entry = bin.entries()[0]
bin.restore([entry])
That's it. It doesn't get any simpler than that.
Entries are returned as a list of TrashEntry dataclasses, which contain the following attributes:
TrashEntry(
name='Screenshot from 2026-06-10 17-35-55.png',
original_path='/home/nspc911/Pictures/Screenshots/Screenshot from 2026-06-10 17-35-55.png', # this will be None if entry doesn't contain this info
deleted_at=datetime.datetime(2026, 6, 28, 11, 31, 17), # this can be None if entry doesn't contain this info
size=13075 # shouldn't be None, but it is possible.
)
For now, only the major 3 OSes are supported (Windows, Linux, MacOS). If you want to add support for your OS, feel free to open a PR.
Like what I do? Check out similar projects
- multiarchive: a high level api for handling archives across platforms
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytrash-0.2.0.tar.gz.
File metadata
- Download URL: pytrash-0.2.0.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
386a658e3011afbb5ee45b3cca53e73655fcefa1195bd3e8b8b6f6ec6ad8659f
|
|
| MD5 |
5488bba8ceb7db539182897f53fc2350
|
|
| BLAKE2b-256 |
365251ed45d7fcdda2d4619ed897aa8359f7c472f750d1aacd93a7884ad807fe
|
File details
Details for the file pytrash-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pytrash-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ef2f27c6e641ec77030670640f222e03dde7682fd053cfc8a4b999f7446f980
|
|
| MD5 |
c8923266c6c58eb1b85a27622e609822
|
|
| BLAKE2b-256 |
1116bb3ec67e2cb6fb1fc4a7a9592d1c3f902852d531dcc11be936ed3aa87a8d
|