Skip to main content

drop-in replacement for rm with undo/restore built-in.

Project description

resrm

resrm is a safe, drop-in replacement for the Linux rm command with undo/restore support.
It moves files to a per-user trash instead of permanently deleting them, while still allowing full sudo support for root-owned files.


Features

  • Move files and directories to a trash folder instead of permanent deletion
  • Restore deleted files by short ID or exact basename
  • Empty trash safely
  • Supports -r, -f, -i, --perma options
  • Works with sudo for root-owned files

Installation

NOTE: To use resrm with sudo, the path to resrm must be in the $PATH seen by root.
Either:

  • install resrm as root (preferred), or
  • add the path to resrm to the secure_path parameter in /etc/sudoers. For example, where /home/user/.local/bin is where resrm is:
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/user/.local/bin"

Install via PyPI (preferred):

pip install resrm

Or clone the repo and install locally:

git clone https://github.com/mdaleo404/resrm.git
cd resrm/
poetry install

Usage

# Move files to trash
resrm file1 file2

# Recursive remove of a directory
resrm -r mydir

# Force remove (ignore nonexistent)
resrm -f file

# Interactive remove
resrm -i file

# Permanent delete (bypass trash)
resrm --perma file

# List trash entries
resrm -l

# Restore a file by ID or basename
resrm --restore <id|name>

# Empty the trash permanently
resrm --empty

Trash Location

Normal users: ~/.local/share/resrm/files

Root user: /root/.local/share/resrm/files

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

resrm-0.2.1.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

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

resrm-0.2.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file resrm-0.2.1.tar.gz.

File metadata

  • Download URL: resrm-0.2.1.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.9 Linux/6.17.7-200.fc42.x86_64

File hashes

Hashes for resrm-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c329099c1c7ca6873bd937f411ae997b4499419f5ae6ecd0ec4efb89bc447164
MD5 7ae95bb05d9c246f8e98080ffdeb4fa3
BLAKE2b-256 f009f69a75c8f69d6414ebf976a087514d02adac06a93f0215339d43fe2d48c9

See more details on using hashes here.

File details

Details for the file resrm-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: resrm-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.9 Linux/6.17.7-200.fc42.x86_64

File hashes

Hashes for resrm-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 914f3ccfa5dd5e257fd71fe06496a1315f22a0dbce646336080bfde5941b4d5f
MD5 23d7a5b53d2c898a4f50fe3c89db2e1d
BLAKE2b-256 48c7eda25a669c0093c15f562522ca9d9d75998ee0c907f9274046d561928f79

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