trash-cli
trash-cli copied to clipboard
Trash-list should iterate through directories
Describe the bug
I accidentally deleted 12 TB because when I ran trash-list I saw a few hundred lines but I didn't notice that one of them was a directory. It makes sense that trash-put moves the folder in a quick way but trash-list should arguably be much more verbose.
If this bug was never fixed or "feature" was never included for performance reasons, I would argue that trash-list is usually run before trash-empty and so while it would make trash-list slower, it would usually not be wasteful because the OS will cache the fs-tree and so when trash-empty iterates over the files during deletion it could re-use that metadata.
trash-cli version 0.22.10.20
Are you using the latest version of trash-cli? Yes
Have you tried if the bug is present in the latest version of trash-cli? Yes
Operating system:
- OS: Fedora
To Reproduce
$ mkdir test
$ tee -a test/test
he
he
$ trash-put test
$ trash-list
2023-01-31 21:44:17 /home/xk/test
Expected behavior
$ mkdir test
$ tee -a test/test
he
he
$ trash-put test
$ trash-list
2023-01-31 21:44:17 /home/xk/test/test
or
$ trash-list
2023-01-31 21:44:17 /home/xk/test/
2023-01-31 21:44:17 /home/xk/test/test
I think iterating through all the files should be the default behavior. If the current behavior is not seen as a bug, perhaps that functionality could be exposed via a flag:
ie.
$ trash-list --quick
2023-01-31 21:44:17 /home/xk/test
$ trash-list
2023-01-31 21:44:17 /home/xk/test/test
Alternatively, and less palatable, is this idea:
$ trash-list
2023-01-31 21:44:17 /home/xk/test
$ trash-list --full
2023-01-31 21:44:17 /home/xk/test/test