Last active
June 13, 2022 12:39
-
-
Save blurymind/2888fcd8bce1f723d2f626a4e9790b9a to your computer and use it in GitHub Desktop.
deleteSmallSizeSubFolders.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# fix for folders/files with spaces in them (ln13) | |
OLDIFS=$IFS | |
IFS=$'\n' | |
# thunar folder custom action /home/fox/INSTALL/deleteSmallSizeSubFolders.sh %F | |
# %F is full path to all selected folders | |
for var in "$@" | |
do | |
find "$var" -mindepth 1 -maxdepth 1 -type d -exec du -ks {} + | awk '$1 <= 50' | cut -f 2- | xclip -sel clip | |
for j in $(xclip -selection c -o) | |
do | |
zenity --question --title="Confirm" --text="This folder is likely empty:\n $j\n\nDelete it?" | |
case $? in | |
0) | |
rm -r "$j" | |
zenity --notification --text "Deleted\n$j" | |
;; | |
1) | |
#cancel | |
;; | |
esac | |
done | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment