Skip to main content

A safe alternative for "rm" with minimum difference.

Project description

|rm-protection logo|

rm-protection
=============

A safe alternative for ``rm`` with minimum difference.

What is this?
=============

``rm-protection`` is a safe alternative for removing file. It works
exactly the same as ``rm`` (in fact it passes arguments to rm). The only
difference is that it refuses to procceed if a ``.*.rm-protection`` file is
found and you failed to answer a question.

Quick Start
===========

``pip install rm-protection``

1. Install from PyPi and make an alias for ``rm-p``.
2. Protect your files using ``protect``. If you want to protect everything inside, ``protect -R``.
3. Happy rm-ing!

How does it work?
=================

It consists of two utilities: ``rm-p`` and ``protect``. The latter one
is to help you protect files.

For example, you have a file called ``important_file`` and it is
``protect``\ ed by ``.important_file.rm-protection``. ``rm-p`` will
recognise that ``important_file`` is protected and prompt to ask you a
question stored in ``.important_file.rm-protection``. ``rm-p`` will only
proceed if you get the answer right.

See it in action:

.. figure:: https://ooo.0o0.ooo/2017/02/03/58943760b76ed.gif
:alt: Basic usage
:scale: 80%

Basic usage

It will also prevent you from deleting a directory with ``protect``\ ed
file(s) inside.

.. figure:: https://ooo.0o0.ooo/2017/02/03/589437603366e.png
:alt: Recursive protection
:scale: 80%

Recursive protection

Requirements
============

- Python 2 or 3
- Linux, unix and macOS
- ``find``

Known issues
============

- Currently does not support protecting files whose name starts with
"-".

Comparison with alternative methods
===================================

+---------------------------+---------------+----------------+---------+-------------+
| Methods | Can be uesd | Protect | Flexibi | Additional |
| | as "rm"? | Specific Files | lity | Files |
+===========================+===============+================+=========+=============+
| `trash-cli <https://githu | Yes | Somehow | High | Centralised |
| b.com/sindresorhus/trash- | | | | Config |
| cli>`__ | | | | |
+---------------------------+---------------+----------------+---------+-------------+
| rm -i | Yes | No or Somehow | High | |
+---------------------------+---------------+----------------+---------+-------------+
| `safe-rm <https://launchp | Yes | Yes | Low | Centralised |
| ad.net/safe-rm>`__ | | | | Config |
+---------------------------+---------------+----------------+---------+-------------+
| rm-protection | Yes | Yes | High | One for |
| | | | | each |
+---------------------------+---------------+----------------+---------+-------------+

``rm-protection`` aims at providing maximum protection and flexibility
while making minimum impact on daily operation.

``rm -i`` can be very annoying, ``trash-cli`` is a bit complex (imagine
you have a habit of emptying the trash without a second thought, or
imagine you are trying to free up spaces on a budget vm). Safe-rm is
inconvenient when you really need to delete something (you have to edit
the configuration file).

Instead, ``rm-protection`` asks you a question set by you. You are fully
covered when removing files (you won't accidentally empty the trash with
``trash-cli`` or ``| yes`` with ``rm -i``), and you can quickly remove
files (without editing any configuration files).

How to contribute?
==================

Pull requests and issues are all welcome! Or tell others about this, so
you can even ``protect`` the files you send to others!

.. |rm-protection logo| image:: https://ooo.0o0.ooo/2017/02/03/58943f1ed88cd.png
:scale: 50%



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

rm_protection-0.1.3-py2.py3-none-any.whl (9.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file rm_protection-0.1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for rm_protection-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 047414045bacfcaf0930cb47359fe76c39fbf147285dc55bfd202ef551250dbf
MD5 3c8fec5c5c7e68f6f40740337e988974
BLAKE2b-256 40093cfd36832681293859bd95c8cb2c4d7cf8f1ec36382135289a568d266379

See more details on using hashes here.

Supported by

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