Now we need to work on the issue with the names of the images in the folder. They come in as img_0_0_0.jpg, img_0_0_1.jpg, img_0_0_2.jpg through 24 in an images folder in a parent folder that is the named the same as the barcode. It will always be this way and the only change is the number of images so the second number. After a little searching, a Linux list command found a way to sort the list in the correct order, but we have other items in the folder. A little work was needed first. Step one. Delete everything except the images folder. Step 2 move the images that we are looking for out of the folder. Step 3 delete the images folder.
OK, a folder that is named correctly with our images in it. Now we can rename them. A short ls command with a sort made it possible to cure the non-padded number issue with the images. Long and short, list files as we see them in the Finder.
filelist=`ls * | sort -t_ -k 4,4n`
Now just rename with the folder name.