How to match photo files per datetimeoriginal

Started by JlrJlr, November 24, 2020, 05:38:31 PM

Previous topic - Next topic

JlrJlr

Hello

I am stuck on my trial to match photo files per datetimeoriginal

Here is what I am trying to do :

My original photos stored per  "trip" directory with sub-directories per camera . Original file name are like IMGnnn.jpg

Sometime ago I  organized copy of photo files in sub-directories per  day with cameras photos of the day merged. The files are renamed  "trip-date-n°" n° =1..999.

Now I want to find the original file that was used for the organized copy. Then I expect to store the  original file name in a tag of the organized file

That is why I want to match original and organized by the datetimeoriginal (plus camera model)

What I did so far

First  create "hard links "  on the original files with name
  -d "%%Y-%%m-%%d %%H-%%M-%%S"   "-hardlink<%_DirHdl%$IFD0:Model $datetimeoriginal .jpg"

Now I was expecting to use

-d "%Y-%m-%d %H-%M-%S" -tagsfromfile "X:\zHdlDate\${IFD0:Model} ${datetimeoriginal} .jpg"   -FilePath -FileName -ext .jpg 

Unfortunately I got this message :

File 'X:\zHdlDate\${IFD0:Model} ${datetimeoriginal} .jpg' does not exist for -tagsFromFile option

The file name 'formula' is ok since replacing -tagsfromfile by -p  gives expected result

  -d "%Y-%m-%d %H-%M-%S" -p "X:\zHdlDate\${IFD0:Model} ${datetimeoriginal} .jpg" 
======== X:/aSouvenirs/Voyages/2014-03_Canaries/14-03-08 Laja (Roque Agando)- Imada/Canaries_14-03-08_007.jpg [1/1]
X:\zHdlDate\COOLPIX P7100 2014-03-08 13-05-17 .jpg


-tagsfromfile does not support "formula", as I discovered in the doc "SRCFILE or FMT", now I understand what FMT means !!


How  can I do to do this match ?  Thanks for any  idea .



Phil Harvey

Yes.  -tagsFromFile does not support tags in the filename string.

I don't have time to think about this right now to see how it could be done, but I'll check back again tomorrow.

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

StarGeek

The only thing I could think of would be to run one passs to create a temp args file with the -p (-printFormat) option and then execute that.
"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

JlrJlr

Phil, StarGeek thanks for your  answer.

After a lots of trial and even more errors, I think I have got a solution. It is based on hard links on Original files and also on Organized one.

A "HarLnk" directory that contains

    Links on Organized files "COOLPIX P7100 2014-03-08 13-05-17 .jpg"

    Links on Original files "Orig_COOLPIX P7100 2014-03-08 13-05-17 .jpeg" (same name as organized prefixed by "Orig_" and with extension "jpeg"

The command to copy tags from original to organized is :

   exiftool -overwrite_original_in_place -tagsfromfile "%dOrig_%f.jpeg"   -IPTC:CopyrightNotice  -ext jpg    "C:\DateMatch\HardLnk" 

  overwrite_original_in_place is the key.

Before I found it, it was the file hardlink "COOLPIX P7100 2014-03-08 13-05-17 .jpg" that was updated (and the link broken) and not the target

Result


======== C:/DateMatch/HardLnk/COOLPIX P7100 2014-03-08 13-05-17 .jpg [1/1]
Setting new values from C:/DateMatch/HardLnk/Orig_COOLPIX P7100 2014-03-08 13-05-17 .jpeg
Rewriting C:/DateMatch/HardLnk/COOLPIX P7100 2014-03-08 13-05-17 .jpg...
  Editing tags in: APP13 IPTC Photoshop
    1 directories scanned
    1 image files updated


Now I will run this on hundreds of file and keep fingers cross.

ExifTool is really a great tool thanks Phil.