ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: yuryn on January 19, 2011, 04:06:16 AM

Title: How copy metadata in batch when src can't be obtained from dst easily?
Post by: yuryn on January 19, 2011, 04:06:16 AM
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
Title: Re: How copy metadata in batch when src can't be obtained from dst easily?
Post by: Phil Harvey on January 19, 2011, 07:21:59 AM
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
Title: Re: How copy metadata in batch when src can't be obtained from dst easily?
Post by: yuryn on January 19, 2011, 01:22:39 PM
Hi Phil,

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

Thank you very much, Jiri Humpolicek