Coder Social home page Coder Social logo

foolproofrm's Introduction

Fool-proof rm

Have you ever rm'ed something by mistake? It happens to the best of us, including the creators of Toy Story 2 (Try to Google "Toy Story 2 rm").
Fool-proof rm is a small tool to prevent exactly that. You use it and call it exactly like rm but, instead of permanently deleting files and folders, it time-stamps and moves them to its own trash folder. Similar tools either define a list of protected folders, or implement a trash managment that requires specific commands.

Usage

After installation, calling rm will move files or folders to the trash folder and prepend the time of deletion to the filename. The flags are the same as the native rm (see currently supported flags below). To permanently delete files (traditional, dangerous behavior) use the flag -D. The standard rm command can still be run using the fully qualified path (generally /bin/rm).

Supported flags

Flag Supported/New Comments
-D New Behave as traditional rm1
-E New Empty trash
-r Yes ---
-f Partial Don't prompt for read-only files
-h Yes ---
-v Yes ---
-i Not yet ---
--version Not yet ---

1 The rest of the flags are passed to rm directly. For instance, rm -Dfv testfile maps to /bin/rm -fv testfile.

Installation

Clone this repository and run:

bash install.sh
source ~/.bashrc

The installation simply creates an alias to the script that "shadows" rm making the use of fool-proof rm transparent to the user. No other change is made to the system. Of course, you can also create a different alias--the script is totally self-contained. Similarly, simply remove the rm alias in ~/.bash_aliases to uninstall.

Alternative tools

  • safe-rm
    Prevents removal of a predefined list of folders.
  • rm-protection
    Similar to safe-rm but asks for confirmation instead of preventing deletion.
  • trash-cli
    Implements a trash system, though it has its own commands that differ from rm.

foolproofrm's People

Contributors

oraziogallo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.