#!/bin/bash FILES=$(find illustrations -maxdepth 2 -name '*.jpg' -printf '%p ') for f in $FILES; do small_dir=$(dirname $f)/small mkdir -p "$small_dir" magick convert -resize 75% "$f" "$small_dir/$(basename $f)" done