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

# pip (recommended)
pip install rmsafe

# Homebrew
brew tap leftrk/tap
brew install rmsafe

# uv
uv tool 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 --dev
uv run pytest  # 1106 tests, 93% coverage

CI runs on Ubuntu + macOS for full platform coverage.

See CONTRIBUTING.md for details.

License

MIT

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.1.1.tar.gz (106.9 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.1.1-py3-none-any.whl (46.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rmsafe-1.1.1.tar.gz
  • Upload date:
  • Size: 106.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","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

Hashes for rmsafe-1.1.1.tar.gz
Algorithm Hash digest
SHA256 aef331dc6c072d55ed05fe9181b4b1dc2efdf7b1b3c3d416bdf1f5030f67ab6a
MD5 a2d49aeb8f174105b7aebe223a2c119a
BLAKE2b-256 2d4805b29137e5be97b03a7868592a5a361fa504d9d56183d46b74b96d9dbf9f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rmsafe-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 46.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","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

Hashes for rmsafe-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 598e58357c5e9a05efd3a3423d11bec83bb5ea00bae824ad4e476986f76cd8a1
MD5 fe90e2ffeb57c3389df10a7d997fc0bd
BLAKE2b-256 029e2bb88faae3fa6ebd52320878beaf35b826a90a013c4ffe2da86dd9a21aa8

See more details on using hashes here.

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