Skip to content

CLI application for managing Recycle Bin | Cross Platform | Supports Windows and Linux

License

Notifications You must be signed in to change notification settings

tribhuwan-kumar/trashbhuwan

Repository files navigation

trashbhuwan

introduction:

CLI application for managing recycle bin. its cross-platform, supports Windows & Linux

demo

demo.mp4

why?

i'm a termit (terminal+hermit), i mostly time spend in terminal and leaving terminal is too painful for me, mostly when i just need to put some files in recycle bin. and the verity is i usually don't delete files bcz there is always a certainty of "what if the file i just deleted is might be needed after sometimes!" that's why i created this cli application, which solves the problem of putting and restoring file from recycle bin.

i know there are multiple tools already created for this purpose, but they are written in python/javaScript & they aren't cross platform, which doesn't seem okay to me!

installation

for linux:

curl -sSL https://raw.githubusercontent.com/tribhuwan-kumar/trashbhuwan/refs/heads/main/install.sh | bash

on windows:

Invoke-Expression (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/tribhuwan-kumar/trashbhuwan/refs/heads/main/install.ps1')

options:

trashbhuwan --help                              : Show help
trashbhuwan --empty                             : Empty the recycle bin
trashbhuwan --list                              : List all files of recycle bin with disk usage
trashbhuwan --put [file/directory]              : Put files in recycle bin
trashbhuwan --restore [file/directory]          : Restore a file from recycle bin
trashbhuwan --restore-dest [file/directory]     : Restore a file or directory to specified destination
trashbhuwan --delete [file/directory]           : Delete files from recycle bin, permanently!

pass multiple files separating by double quotes or single quotes.

integrations:

lf terminal file manager:

use this functions & mapping to intergrate trashbhuwan with lf:
# for putting a file in recycle bin
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
}}

# for restoring a file from recycle bin
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

# only for linux
map gt cd ~/.local/share/Trash/files

neo-tree.nvim neovim file manager:

use my fork of neo-tree.nvim with trashbhuwan integration tribhuwan-kumar/neo-tree.nvim. it'll help you managing recycle bin directly from neovim.

architecture

it uses the native api of windows so it'll work same as the file explorer of windows
on linux, it manages trashcan same as the dolphin file manager!

for more information see:

trashbhuwan --help