diff options
Diffstat (limited to '.old/delsimpic')
-rwxr-xr-x | .old/delsimpic | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/.old/delsimpic b/.old/delsimpic new file mode 100755 index 0000000..83c3d1a --- /dev/null +++ b/.old/delsimpic @@ -0,0 +1,39 @@ +#!/usr/bin/awk -f +function convtobytes(num) { + if (match(num, " K")) + mul = 1000 + else if (match(num, " M")) + mul = 1000 * 1000 + else if (match(num, " G")) + mul = 1000 * 1000 * 1000 + else + mul = 1 + return int(num * mul) +} + +BEGIN { + cmd = "czkawka_cli image -d $PWD" + FS = " - " + largestsize = 0 + imc = 0 + k = 0 + while (cmd | getline) { + print $0 + if (!match($0, "^/")) { + delete images + largestsize = 0 + imc = 0 + k++ + break + } + images[$imc] = $0 + if (size = convtobytes($3) > largestsize) { + largestsize = size + keep[$k] = $1 + } + imc++ + } + for (image in keep) { + print $image + } +} |