-tagsfromfile based on matching datetimeoriginal (and not filename)

Started by mikelee33, March 16, 2017, 10:41:12 AM

Previous topic - Next topic

mikelee33

Good day -

I have created a number of JPG files from CR2 files where the JPG file name is not the same as the original CR2.  For example:  IMG_4018.CR2 and IMG_4018_2.JPG  (and maybe even an IMG_4018_3.JPG if I've created multiple versions)

I would like to use the -tagsfromfile command to copy all the metadata from the original CR2 files to the appropriate JPG files based on their matching datetimeoriginal tags.  While I initially thought about renaming all the files to datetimeoriginal and then simply copying the metadata, this approach I feel is not feasible, and not compatible with my existing filing system.  Could I maybe use an -if expression to conditionally copy when the datetimeoriginal tags match?  If so, how would that be structured?

I might think this a not too uncommon scenario when JPG versioning comes into play.  Any suggestions on how I should proceed?

Many thanks.
Mike

Phil Harvey

Things are much easier if the first 8 characters of the JPG file name give the CR2 file name.  Is this the case?

Otherwise, perhaps you could use the ExifTool HardLink feature to create a set of linked files with common names based on DateTimeOriginal, then use these links to copy the information.

- 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 ($).

mikelee33

Hello Phil -

Sometimes the JPG file name (somewhat) mirrors the CR2, sometimes not, and certainly without consistency as to the number of matching characters.

Am I to interpret your reference to the HardLink feature to mean that you might also be inclined to rename the files (temporarily) to DateTimeOriginal?  I can now see how this approach could work, and I will research HardLink further, as I have never used it.

This does give me direction, so thank you.

Mike
Mike

StarGeek

Quote from: mikelee33 on March 16, 2017, 01:00:31 PM
Am I to interpret your reference to the HardLink feature to mean that you might also be inclined to rename the files (temporarily) to DateTimeOriginal?  I can now see how this approach could work, and I will research HardLink further, as I have never used it.

See this thread for the basic idea. 
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

mikelee33

StarGeek -

Thank you.  Indeed, that was among the threads I had read when I was initially trying to figure out a way to accomplish my task, and was the very first time I had ever heard of the HardLink feature.  While I don't fully understand it, I will certainly pursue this route.  You have made me aware that the referenced thread is a key discussion on this feature.

Mike 
Mike

Phil Harvey

I think the commands could look something like this:

1. exiftool "-hardlink<tmp/$datetimeoriginal" -d %Y%m%d%H%M%S -r DIR

2. exiftool -tagsfromfile %d%f.CR2 -ext jpg tmp

3. then you should be able to delete the entire tmp folder after making sure that everything went OK.

- 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 ($).