andreafrancia / trash-cli

Command line interface to the freedesktop.org trashcan.
GNU General Public License v2.0
3.63k stars 177 forks source link

Option to show preview and/or confirmation #203

Closed stingray21 closed 3 years ago

stingray21 commented 3 years ago

I love using trash-cli and really appreciate that files are moved to the trash instead of been deleted right away, so I have a second chance and can recover the files. It usually works great this way, but sometimes it would be great to even prevent accidental deletions. For instance, when I get impatient and try to take shortcuts by using wildcards for trashing files (e.g. trash ./file*). This can sometimes have pretty bad results, and many files are trashed that I did not intend to.

Would it be possible to either show a list of files that will be deleted when wildcards are used, and then asking for confirmation. Or maybe just an option for enabling a warning (e.g. "You are about to delete files using wildcards, are you sure?"). Maybe this could be expanded to "typical errors" while deleting (e.g. accidentally deleting current users home folder, important system files, etc.).

andreafrancia commented 3 years ago

From the 0.21.5.25 release trash-put honors the -i option. Example:

$ touch foo
$ trash-put -i foo
trash-put: trash regular empty file 'foo'? y
$ 

You can add alias trash-put='trash-put -i' to your .bashrc