All the relevant things have already been said, and because I have also recently had to mess with sequencing (also my brain seems to be refusing to comprehend exactly what you a asking) so I will just brainfart a bit.
body 1: filenames 0006nnnn.DNG (because it's up to around 68000 actuations)
body 2: filenames _A00nnnn.DNG (because it's up to around 2500 actuations and uses the Adobe colorspace)
The former camera went berserk with filenames a while back, incrementing them by several thousand after a weird power issue. So I tend to realign that sequence with the shutter actuations if in doubt. I guess I would do the samewith the second body too, just with the correspondingly different filename prefix.
.pp3's are a RawTherapee metadata sidecar file...because I only realised the sequencing was shot AFTER processing ~1500 images.
Code:
#!/bin/sh
origname=
newname=
ls -l | awk 'NR!=1 && !/^d/ {print $NF}' | while read name
do
ext=${name##*.}
if [ "$ext" = "pp3" ]; then
if [ $name != "${origname}.${ext}" ]; then
# echo rm $name
rm --verbose --force $name
else
# echo mv ${name} ${newname}"."${ext}
mv --verbose ${name} ${newname}"."${ext}
origname=
fi
else
shuttercount=$(exiftool -s -s -s -ShutterCount $name)
countname=$(printf "%08d" ${shuttercount})
newname=${countname}"."${ext}
origname=${name}
# echo mv ${name} ${newname}
mv --verbose ${name} ${newname}
fi
done
PS: wow, could the board smash code block whitespacing any more? far out.