Code Monkey home page Code Monkey logo

rm-trash's Introduction

rm-trash

"rm-trash" utility puts the files you delete in a shell safely into the Trash (Recycle bin). The script is meant to be used in place of rm system command in linux .

This solves accidental removals. This utility is meant to be used as an alias with rm directly and unlike other such scripts , it can handle duplicate files in the trash and works for recursive arguments and any other options that rm supports. This is a wrapper around rm and thus supports all options of rm.

Features :

  • Meant to be used in place of rm
  • Handles all arguments that rm can take
  • If the deletion was unsuccessful because of wrong arguments , then it deletes the trashed files to save space.
  • Handles the file name collisions with the files already in trash
  • Handles some permission issues automatically
  • If rm is called from any other script or indirectly then the system 'rm' command is used automatically
  • Shows the appropriate error messages exactly like those which arise in rm

How It Works :

It first gets the arguments that you would specify for rm command and then if the files have right permissions then saves the files in the trash with the required meta data about it. After saving , it gives the file for deletion to rm with the given options.

If deletion of was unsuccesful for some reason , it deletes back the saved file or folder from the trash to save space.


Installation :

sudo add-apt-repository ppa:nateshmbhat/rm-trash
sudo apt-get update
sudo apt-get install rm-trash
  • (Optional step) Its recommended to set an alias to "rm-trash" for easier access to the command :

    Append the below lines to ~/.bash_aliases file to set alias when the shell starts

    alias "trash"="rm-trash"
    # or 
    alias "del"="rm-trash"

Usage :

Usage is just like we use the rm command normally and supports all options of rm.

rm-trash filename foldername -r

Now it shows your filename in the Trash which can then be easily restored to any desired location.

Options :

--no-trash : no trash option .

Add this option to the command to prevent it from putting the files to trash. Useful when you want to remove huge amount of files and sizes.

rm-trash folder/ -r --no-trash

rm-trash's People

Contributors

nateshmbhat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rm-trash's Issues

Your ubuntu repo is out of date!

Reading package lists... Done
E: The repository 'https://ppa.launchpadcontent.net/nateshmbhat/rm-trash/ubuntu jammy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Thought mayhaps that you might be interested. Looks otherwise like an interesting utility!

not wokring iwth

Unlike "rm", "rm-trash" does not work with removing directories with spaces:

mkdir a\ b
rm-trash -r a\ b/

Gives:
rm: cannot remove 'a': No such file or directory
rm: cannot remove 'b/': No such file or directory

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.