andreafrancia / trash-cli

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

[wishlist] option or command to open trashed files or at least get their path #202

Closed hydrargyrum closed 3 years ago

hydrargyrum commented 3 years ago

Is your feature request related to a problem? Please describe.

I want to view some of the trashed files to make sure I really want to get rid of them, check if I didn't trash some of them by mistake. It may be because I typed too fast, used an inadvertently too broad wildcard pattern, or also because I have trashed files long ago, but did not empty trash since then.

Describe the solution you'd like

I have several propositions for achieving the same thing:

trash-open

Open a deleted file directly

% trash-open [options for filtering?] [options for selecting `open` command]
0 2007-08-30 12:36:00 /home/andrea/foo.jpg
1 2007-08-30 12:39:41 /home/andrea/bar.jpg
2 2007-08-30 12:39:41 /home/andrea/bar2.txt
3 2007-08-30 12:39:41 /home/andrea/foo2.avi
4 2007-08-30 12:39:41 /home/andrea/foo.png
what file to view [0..4]: 4
[spawns `xdg-open /home/andrea/.local/Trash/files/xxxx.png corresponding to old /home/andrea/foo.png`]

trash-paths (or an option to trash-list)

Simply show the actual path, let the user open by their own means.

% trash-paths [options for filtering?]
2007-08-30 12:36:00 /home/andrea/foo.jpg -> /home/andrea/.local/Trash/files/1.jpg
2007-08-30 12:39:41 /home/andrea/bar.jpg -> /home/andrea/.local/Trash/files/2.jpg
2007-08-30 12:39:41 /home/andrea/bar2.txt -> /home/andrea/.local/Trash/files/3.txt
2007-08-30 12:39:41 /home/andrea/foo2.avi -> /home/andrea/.local/Trash/files/4.avi
2007-08-30 12:39:41 /home/andrea/foo.png -> /home/andrea/.local/Trash/files/5.png

or trash-list --real-paths.

andreafrancia commented 3 years ago

Added in the 0.21.5.20 version.

vagrant@buster:~$ trash-list --files
2021-05-17 10:12:19 /home/vagrant/foo -> /home/vagrant/.local/share/Trash/files/foo
2021-05-17 10:12:21 /home/vagrant/foo -> /home/vagrant/.local/share/Trash/files/foo_1
2021-05-17 10:12:22 /home/vagrant/foo -> /home/vagrant/.local/share/Trash/files/foo_2
2021-05-17 10:12:27 /home/vagrant/bar -> /home/vagrant/.local/share/Trash/files/bar
hydrargyrum commented 3 years ago

Wow that was fast, thanks!