-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtra_ls.sh
54 lines (44 loc) · 1.06 KB
/
tra_ls.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/zsh
#
# /
# |_| >_
#
#
# tra.sh: zsh scripts for trash management
# https://marie-helene-burle.netlify.com
# https://github.com/prosoitos
# https://twitter.com/MHBurle
#
# GNU Affero General Public License
#
#
# This script lists the content of the trash
# topdir=$(findmnt -T . -n -o TARGET)
# if [[ $topdir = /home ]]
# then
# trash_path=$HOME/.local/share/Trash
# else
# trash_path=$topdir/.Trash-1000
# fi
trash_path=$HOME/.local/share/Trash
files_path=$trash_path/files
info_path=$trash_path/info
for i in $files_path/*(D)
do
if [[ -d $i ]]
then
dir_or_file="D"
else
dir_or_file=" "
fi
basename=${i#$files_path/}
original_path=$(grep 'Path=' $info_path/$basename.trashinfo |
sed 's/Path=//' |
sed 's/%20/ /g') 2> /dev/null
deletion_time=$(grep 'DeletionDate=' $info_path/$basename.trashinfo |
sed 's/DeletionDate=//' |
sed 's/T/ /') 2> /dev/null
list=$(echo $deletion_time $dir_or_file $original_path \| $basename)
echo $list
done | sort -r | fzf -i -e +s