Skip to content
/ rm.sh Public

This script is a rm wrapper which prevents from inadvertently deleting an important file

Notifications You must be signed in to change notification settings

matdexir/rm.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 

Repository files navigation

Why rm.sh?

🔨 Obviously, while taking care of our system we inadvertently deleted (👀 at you,rm) and lost a very important file forever. I do know the existence of the -i flag, however it does not protect against the dreaded 🚩 -rf. So as another measure of security, I added an extra-layer security with rm.sh. In the grand scheme, it temporarily moves the file to be deleted to a directory TRASH_DIR(can be set as env variable ♻️) and the same file can, later on, be permanantly deleted or recovered.

After a few tweaks 🔧, I came up with rm.sh and I firmly believe that it's a solid wrapper for rm.

USAGE

rm.sh 0.1.0 by @matdexir

DESCRIPTION:
This program is a rm replacement for sloppy just like me. It is essentially a wrapper for rm and mv commands.

OPTIONS:
	-h|--help:	Displays the current help message
	-e|--empty:	Empties the trash directory defined by $TRASH_DIR
	-c|--clear:	Clears the files that are older than 30 days inside $TRASH_DIR

Recommendation: For convenience's sake, you could put this into your crontab.

# crontab format
# * * * * *  command_to_execute
# - - - - -
# | | | | |
# | | | | +- day of week (0 - 7) (where sunday is 0 and 7)
# | | | +--- month (1 - 12)
# | | +----- day (1 - 31)
# | +------- hour (0 - 23)
# +--------- minute (0 - 59)
0 0 * * * /path/to/rm.sh -c

TODO LIST

  • Implement the list feature

About

This script is a rm wrapper which prevents from inadvertently deleting an important file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages