Open chapmanjacobd opened 1 year ago
I think displaying all inner directories and files by default would be excessive; it would be easy to miss what else is in the trash if there are large directories there. Although a flag like --full
or --all
would be convenient. But I do think that it would be helpful if trash-list displayed directories in a different color. That way, they could be more immediately recognized.
as a stopgap one thing I've been doing is using ncdu
on all .Trash
directories that I'm interested in before running trash-empty
function trash-empty
if test -z "$argv"
echo Error! No mount points passed as args
return 1
end
trash-size
trash-list | tee -a ~/.local/share/trashed.txt
for mnt in $argv
for d in $mnt/.Tras*/*/files/
NO_COLOR=1 ncdu "$d"
end
end
if gum confirm --default=no 'Refresh snapshots?'
for mnt in $argv
btrfs_nocheck_delete_snapshot $mnt
end
wait
end
if gum confirm --default=no 'Empty trash?'
command trash-empty -f
end
end
function trash-size
for f in ~/.local/share/Trash/ /mnt/d/.Trash/
echo $f
du -hs $f
end
end
function btrfs_nocheck_delete_snapshot --argument mnt
sudo btrfs subvolume delete --commit-each $mnt/.snapshots/one
sudo btrfs subvolume snapshot -r $mnt $mnt/.snapshots/one
end
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:
To Reproduce
Expected behavior
or
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.
Alternatively, and less palatable, is this idea: