#!/bin/bash count=0 LC_ALL=C dir=public/images/screenshots rm -rf "${dir}" mkdir -p "${dir}" SECONDS=0 for file in screenshots/*.jpg; do newName="loom-$(printf '%03d' "${count}").jpeg" thumbName="${newName%.*}-thumb.jpeg" echo -n "${count}: ${file}... "; cp "${file}" "${dir}/${newName}" magick "${file}" -resize x120 -quality 50 -strip "${dir}/${thumbName}"; echo "done"; count=$((count + 1)) done echo "done in ${SECONDS}s"