Skip to main content

Modern rm replacement with trash, undo, and Btrfs support

Project description

rmsafe

A modern rm replacement that moves files to trash instead of deleting them.

English | 中文

Install

# uv (recommended)
uv tool install rmsafe

# pipx
pipx install rmsafe

# Homebrew
brew install leftrk/tap/rmsafe

# pip
pip install rmsafe

Usage

Replace rm in your shell:

alias rm='rmsafe trash'

Commands

Command Description
rmsafe trash <files> Move files to trash
rmsafe restore <pattern> Restore trashed files
rmsafe list [pattern] List trashed files
rmsafe undo [n] Undo recent deletions
rmsafe undo --list Show undo history
rmsafe empty [days] Empty trash
rmsafe status Trash statistics

Examples

rmsafe trash file.txt              # Move to trash
rmsafe trash *.log --dry-run       # Preview
rmsafe restore file.txt            # Restore
rmsafe undo                        # Undo last deletion
rmsafe undo --list                 # Show history table
rmsafe empty 7                     # Delete files older than 7 days
rmsafe status                      # Panel with stats

Features

  • Rich output: Tables, panels, icons, progress bars
  • Undo history: Track and undo recent deletions
  • Smart UX: Progress bar for batch operations, transient cleanup
  • Cross-platform: macOS (~/.Trash), Linux (FreeDesktop Trash spec)
  • Btrfs optimized: Zero-copy reflink clone on Linux
  • JSONC config: Comments and trailing commas supported

Config

~/.config/rmsafe/config.jsonc:

{
  "trash": { "location": null, "auto_clean_days": 30 },
  "behavior": { "confirm_large_files": "10MB", "undo_history_limit": 100 },
  "output": { "color": "auto", "icons": true }
}

vs trash-cli

Feature rmsafe trash-cli
Output Rich tables/icons Plain text
Undo history Built-in Limited
Progress bar Yes (≥4 files) No
Config format JSONC INI
Btrfs clone Yes No

Development

git clone https://github.com/leftrk/rmsafe.git
cd rmsafe
uv sync
uv run pytest
uv run ruff check .

CI runs on Ubuntu + macOS × Python 3.11–3.13.

License

GPL-2.0

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

rmsafe-1.2.0.tar.gz (126.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rmsafe-1.2.0-py3-none-any.whl (46.4 kB view details)

Uploaded Python 3

File details

Details for the file rmsafe-1.2.0.tar.gz.

File metadata

  • Download URL: rmsafe-1.2.0.tar.gz
  • Upload date:
  • Size: 126.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rmsafe-1.2.0.tar.gz
Algorithm Hash digest
SHA256 f6cf907c1d4ad7e25dd7081c225a4344a3d78a94fb7aec93a40992cddd98056a
MD5 0aa997cd4343fff415e74dbd1fbc2100
BLAKE2b-256 30941b72630f0dea37ececd2a8a2c8b157ac8381bcaf87a4279e0e86c58295a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for rmsafe-1.2.0.tar.gz:

Publisher: release.yml on leftrk/rmsafe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rmsafe-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: rmsafe-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 46.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rmsafe-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4088db2890e6a4e5a7ecc2f4c4f214c937fb41ddd11a4f0e11665829a4dd7f36
MD5 7b5b3c6525ebe7e116e88b87e6d8646f
BLAKE2b-256 60969a3905c5b2cddf80458f1186cda31b741e0325174cfc0fadc798cbb51d32

See more details on using hashes here.

Provenance

The following attestation bundles were made for rmsafe-1.2.0-py3-none-any.whl:

Publisher: release.yml on leftrk/rmsafe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page