Skip to content

Instantly share code, notes, and snippets.

@pretorh
Last active September 7, 2022 08:17
Show Gist options
  • Save pretorh/5d2dbcfb15b498022d34f26a10609d1b to your computer and use it in GitHub Desktop.
Save pretorh/5d2dbcfb15b498022d34f26a10609d1b to your computer and use it in GitHub Desktop.
List missing sequentially numbered files

for example for photos from a camera (IMG_xxxx.JPG): ./missing-files-in-sequence.sh '*IMG_' 3409 '.jpg'

#!/usr/bin/env sh
set -e
prefix=$1
sequence=$2
suffix=$3
item=$sequence
while true ; do
name="$prefix$item$suffix"
printf "%s\r" "$name"
if [ -z "$(find . -name "$name")" ] ; then
echo "missing: $name"
fi
item=$((item + 1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment