Skip to content

Instantly share code, notes, and snippets.

@stvoidit
Created July 8, 2024 22:38
Show Gist options
  • Save stvoidit/ecf66a67984edcb51b58ab56852effe6 to your computer and use it in GitHub Desktop.
Save stvoidit/ecf66a67984edcb51b58ab56852effe6 to your computer and use it in GitHub Desktop.
imv-folder with sorting by mtime
#!/bin/bash
image="$1"
declare -a ARGS order
readarray -t order < <(find "$(dirname "$image")"/* -maxdepth 2 -printf "%T+\t%p\n" | sort -r | sed 's/^.*\t//')
for a in "${order[@]}"; do
if [ -f "$a" ]; then
# echo $a
ARGS+=("$a")
fi
done
exec /usr/libexec/imv/imv "${ARGS[@]}" -n "$image"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment