A cli trash bin for files and directories instead of deleting them directly.
Go to file
Kim Oliver Drechsel 6f5b5ce47c
All checks were successful
continuous-integration/drone/push Build is passing
Update 'README.md'
2021-10-30 09:49:23 +02:00
.drone.yml fix drone pipeline 2021-10-28 02:07:09 +02:00
.gitignore update .gitignore 2021-09-21 18:08:19 +02:00
LICENSE fix LICENSE 2021-10-22 12:11:21 +02:00
README.md Update 'README.md' 2021-10-30 09:49:23 +02:00
trash.sh minor changes 2021-10-28 02:02:36 +02:00

trash.sh - A cli trash bin for files and directories instead of deleting them directly

Build Status

Installation:

Put the trash.sh file to your desired location (e.g home directory) and source it in your $HOME/.bashrc or in /etc/.bashrc:

. /path/to/trash.sh
  • When the script runs, it first checks if $HOME/.trash/ (your trash bin) exists and creates it if missing.

Add the cleanup job to your crontab:

# .trash cleanup of all contents (files and dirs) older than 31 days every morning at 06:00
0 6 * * 0 find $HOME/.trash/ -mtime +31 -delete  

Usage:

  • trash FILE1 DIR2 ... or trash_put FILE1 DIR2 ... to move files and directories with relative or absolute paths to your .trash
  • trash_list to list all files and dirs that you put in the trash in the last 30 days
  • trash_empty to remove all files and dirs in your trash
  • trash_rm FILE1 DIR2 ... to delete specific files and directories in your trash
  • trash_restore FILE1 DIR2 ... to restore specific files and directories from your trash to it's origin

Credits

Repo Icon made by Freepik from www.flaticon.com