How copy metadata in batch when src can't be obtained from dst easily?

Started by yuryn, January 19, 2011, 04:06:16 AM

Previous topic - Next topic

yuryn

I am writing an metadata update script, which obtain src name from dst name by cleaning comment and change path e.g.:

dst="indie-2010/big_pictures/0003_CRW_7241-Nadrazi-v-Dilli.jpg"
src="original_images/2010-08-12-Indie/0003_CRW_7241.jpg"

update_script:

ls -1 | while read dst ; do
     src=do_substring(dst, find_position(dst, '-'));
     
     exiftool -all= -tagsfromfile "$src" -exif:all "$dst"
done

It works fine, but I want to run this at once as a batch (because executing exiftool for each file is slow) and I don't know how to pass two arguments per one file ... Is it somehow possible?

Thanks, Jiri Humpolicek

Phil Harvey

Hi Jiri,

I don't know what you mean my 2 arguments per file, but you could try something like this:

rm args.tmp
ls -1 | while read dst ; do
     src=do_substring(dst, find_position(dst, '-'));
     
     echo "-all=" >> args.tmp
     echo "-tagsfromfile" >> args.tmp
     echo "'$src'" >> args.tmp
     echo "-exif:all" >> args.tmp
     echo "'$dst'" >> args.tmp
     echo "-execute" >> args.tmp
done
exiftool -@ args.tmp
rm args.tmp


- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

yuryn

Hi Phil,

that is exactly what I wanted. I missed -execute option.

Thank you very much, Jiri Humpolicek