"exiftool -if '$jpgfromraw' -b -jpgfromraw -w %d%f_%ue.jpg -execute -if '$previewimage' -b -previewimage -w %d%f_%ue.jpg -execute -tagsfromfile @ -srcfile %d%f_%ue.jpg -overwrite_original -common_args --ext jpg DIR
[Advanced] Extract JpgFromRaw or PreviewImage from all but JPG files in DIR, saving them with file names like image_EXT.jpg, then add all meta information from the original files to the extracted images. Here, the command line is broken into three sections (separated by -execute options), and each is executed as if it were a separate command. The -common_args option causes the --ext jpg DIR arguments to be applied to all three commands, and the -srcfile option allows the extracted JPG image to be the source file for the third command (whereas the RAW files are the source files for the other two commands).'
D. Snowdon, E. Sueur, S. Petters, and G. Heiser. EuroSys '09: Proceedings of the 4th ACM European conference on Computer systems, page 289--302. New York, NY, USA, ACM, (2009)
O. Tardieu, and S. Edwards. EMSOFT '06: Proceedings of the 6th ACM & IEEE International conference on Embedded software, page 142--151. New York, NY, USA, ACM, (2006)
M. Moallemi, J. Gutierrez-Alcaraz, and G. Wainer. SpringSim '08: Proceedings of the 2008 Spring simulation multiconference, page 1--4. New York, NY, USA, ACM, (2008)