Using data from multiple sources to write metadata to multiple output files

Started by Number45, February 20, 2015, 03:39:23 AM

Previous topic - Next topic

Number45

I've done a good bit of reading on this, both through the manuals/tutorials and this forum and the various corners of the internet and I don't think I've come across what I'm trying to achieve so I thought I'd ask here.

At the moment, I use the following two lines to first strip all metadata than add back in what I want (this is so that I can upload them to hosting services, and expose only the bare minimum that is necessary):

exiftool -all= image.jpg
exiftool -overwrite_original -tagsfromfile image.jpg_original -make -model -lens -artist -copyright -exposuretime -fnumber -exposureprogram -iso -focallength -datetimeoriginal -flash -colorspace image.jpg


This obviously does what I need for a single file, but I'm looking for a way that I can easily apply this to multiple images. I know I can strip the data from all files in a directory with:

exiftool -all= .

But I can't work out how I can use the -tagsfromfile switch (with @ I assume) and get the right data from the right source file into multiple output files. It might be that I need to use another scripting method (I'll be running this on OS X) so that I can drag files to a script, which is fine, but exiftool seems like such a versatile tool and what I'm doing seems like it should be relatively straightforward (given my limited skills in this area, I don't mean to belittle anyone or anything here) that I was hoping it might be something I can achieve without needing to do that.

Any help would be appreciated.

Phil Harvey

You are overthinking this.  It is as simple as:

exiftool -all= -tagsfromfile @ -make -model -lens -artist -copyright -exposuretime -fnumber -exposureprogram -iso -focallength -datetimeoriginal -flash -colorspace DIR

where DIR is one or more directory and/or file names.

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

Number45

Thanks so much! It did seem like it should be simple, I just couldn't get my head around it.

Going to go away now and do some testing.