-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathempty-trash
More file actions
executable file
·21 lines (21 loc) · 870 Bytes
/
empty-trash
File metadata and controls
executable file
·21 lines (21 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
if test -e $HOME/.lockSvuotaCestino ; then
sleep 2;
else
touch .lockSvuotaCestino
let numeroElementi=`ls -1 -a $HOME/.local/share/Trash/files/ | wc -l`-2
if [ $numeroElementi == 0 ]; then
notify-send -t 100 -u low -i emptytrash "Cestino già vuoto" "Il cestino non contiene elementi"
else
if rm -r $HOME/.local/share/Trash/files/* >> /dev/null; then
notify-send -u low -i emptytrash "Cestino svuotato" "Il cestino è stato svuotato correttamente"
else
notify-send -i edittrash "Cestino non svuotato" "Errori nello svuotamento. Il cestino potrebbe contenere ancora elementi. Controllarne i permessi"
if zenity --question --title "Svuota cestino" --text "Vuoi svuotare il cestino con i permessi di root?" ; then
gksudo "rm -r $HOME/.local/share/Trash/files/"
fi
fi
fi
sleep 2;
rm $HOME/.lockSvuotaCestino
fi