From d75d53fe79ee7cf0d2efd30d5e191def8c746056 Mon Sep 17 00:00:00 2001 From: Timmy Keller Date: Tue, 26 Oct 2021 02:25:17 -0500 Subject: changed a bunch of video scripts and added my first and possibly last python script, although it was fun --- old/delsimpic | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 old/delsimpic (limited to 'old') 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 + } +} -- cgit v1.2.3