trash-1.4/0000755000175000001440000000000013407250526012352 5ustar slackjeffuserstrash-1.4/trash0000755000175000001440000000416713407250070013423 0ustar slackjeffusers#!/bin/sh # Dont ultrapass header "|" #-------HEADER-------------------------------------------------------| #AUTOR: # Jefferson Rocha # #DESCRIPTION: # Trash is a utility that runs via cli. # #USAGE # trash # #CHANGELOG # (V1.2) 20/03/2018 - Jefferson Rocha # - Now if you run as root it does not show any more errors! # # (V1.3) 14/06/2018 - Jefferson Rocha # - Now rm remove files and directories started with '-' # # (V1.4) 21/12/2018 - Jefferson Rocha # - Changed wrong word 'Sucessfull' by 'Sucessful' # - Removed the 'dot' in files size print. # - Add silence Option # - Add Help Option #--------------------------------------------------------------------| #=================VARS dir_trash="${HOME}/.local/share/Trash/files/" # Trash Directory archive_temp="/tmp/random.trash" # Temp Archive silent="1" # Silence OFF #=================FUNCTIONS HELP(){ cat < WEB: < https://notabug.org/jeffersonrocha/trash > EOF return 0 } size_archives(){ cd ${dir_trash} 2>/dev/null && du -hs | sed 's/.$//'> ${archive_temp} if [ -e "/tmp/random.trash" ]; then echo -e "\033[34;1mTotal Size:\033[m $(cat /tmp/random.trash) ----------------------------------" fi # Remove a temp archive rm "${archive_temp}" 2>/dev/null } #=================START # Checking if user has passed parameter case $1 in -q|--silent) silent="0" # 0 Silent OFF | 1 Silent ON ;; -h|--help) HELP exit 0 ;; esac # Silent on? Ok, verbose now. if [ "$silent" = "1" ]; then size_archives # call function quiet="v" fi # directory exist?, bye bye. if [ -d ${dir_trash} ]; then ( # Open subshell cd ${dir_trash} && rm -rf"$quiet" -- * 2>/dev/null [ "$silent" = "1" ] && echo -e "\033[31;1mSucessful.\033[m" ) else echo "Directory '${dir_trash}' not found in system!" fi