Awesome
Trashbhuwan
Introduction:
A simple CLI Application for trashing & restoring files & its written in pure C. It uses the default trashcan of every Linux distribution. trashbhuwan
remembers the original path of the trashed files & directories, so you can restore them later where they were. It is created with developer productivity in mind.
Available options:
trashbhuwan --help : Show help
trashbhuwan --empty : Empty the trash
trashbhuwan --list : List all trashed files & directories with disk usage
trashbhuwan --put [file/directory] : Put files & directories in trash
trashbhuwan --restore [file/directory] : Restore trashed file or directory
trashbhuwan --restore-dest [file/directory] : Restore trashed file or directory to specified destination
trashbhuwan --delete [file/directory] : Delete trashed file or directory permanently
Pass multiple files separating by double quotes or single quotes.
Installation:
Compilation from source code & Installation:
curl -o trashbhuwan.c https://raw.githubusercontent.com/tribhuwan-kumar/trashbhuwan/main/trashbhuwan.c && gcc -o trashbhuwan trashbhuwan.c && sudo mv trashbhuwan /usr/local/bin/
Precompiled executable Installation:
curl -O https://raw.githubusercontent.com/tribhuwan-kumar/trashbhuwan/main/trashbhuwan && chmod +x trashbhuwan && sudo mv trashbhuwan /usr/local/bin/
Manual Installation:
git clone https://github.com/tribhuwan-kumar/trashbhuwan.git && cd trashbhuwan
Compile from source code:
gcc -o trashbhuwan trashbhuwan.c
Configuration:
Now you can either move, copy or create symbolic link of trashbhuwan
to your $PATH
Move:
mv trashbhuwan /usr/local/bin/
or Copy:
cp trashbhuwan /usr/local/bin/
or Create Symbolic Link:
ln -s $PWD/trashbhuwan /usr/local/bin/
Usage:
If you're a lf
user, use this functions & mapping to intergrate trashbhuwan
with lf
:
# TRASHING
cmd trash ${{
files=$(printf "$fx" | tr '\n' ';')
while [ "$files" ]; do
file=${files%%;*}
trashbhuwan -p "$(basename "$file")"
if [ "$files" = "$file" ]; then
files=''
else
files="${files#*;}"
fi
done
}}
# RESTORING
cmd restore_trash ${{
files=$(printf "$fx" | tr '\n' ';')
while [ "$files" ]; do
file=${files%%;*}
trashbhuwan -r "$(basename "$file")"
if [ "$files" = "$file" ]; then
files=''
else
files="${files#*;}"
fi
done
}}
# MAPPINGS
map D trash
map d restore_trash
map gt cd ~/.local/share/Trash/files
If you're using neo-tree.nvim
then use my fork with trashbhuwan
integration tribhuwan-kumar/neo-tree.nvim
For more information see:
trashbhuwan --help