MyCreateDate custom variable in exiftool config

Started by mads, April 20, 2014, 08:22:47 AM

Previous topic - Next topic

mads

Hi there,

How can I change my custom variable so it prefers the CreateDate.

right now I have this variable:

#my custom date to be used when renaming.. using two fields to handle panorama shots sometimes missing the CreateDate, and then using ModifyDate instead
      MyCreateDate => {
         Desire => 'CreateDate',
         Desire => 'ModifyDate',
         PrintConv => '$self->ConvertDateTime($val)',
      },

it works perfectly well for renaming certain panorama files that does not have the CreateDate tag.

PANO_20130706_184326.jpg becomes 2013-07-06 18.43.26 [PANO_20130706_184326].jpg

But when i have another image that for the first time today was one that I have added a gps tag to manually so the ModifyDate was wrong (set to the time where i added the gps tag) I noticed that even though that image had both CreateDate and ModifyDate tag the ModifyDate would be used instead of the more correct CreateDate. I didn't notice that before because I normally never touch the images before my rename workflow and so the CreateDate and ModifyDate is equal.

I would love to get help with changing the variable code so the CreateDate would be used before the ModifyDate if both tags exist.

I tried to swap the two tags in the code, and that did fix the issue, but it broke the original purpose which was to use the ModifyDate if the CreateDate was missing for panorama files.

I am using exif tool 9.58 for windows.

Best Regards,
Mads

Phil Harvey

Hi Mads,

The syntax for the Composite tag is like this:

MyCreateDate => {
Desire => {
0 => 'CreateDate',
1 => 'ModifyDate',
},
PrintConv => '$self->ConvertDateTime($val[0] || $val[1])',
},


However, you don't need a Composite tag to do this.  Instead, you could set the filename from ModifyDate then CreateDate in the same command:

exiftool "-filename<${ModifyDate} Blah blah.%e" "-filename<${CreateDate} Blah blah.%e" -d ...

If CreateDate exists, then it will override the ModifyDate assignment.

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

mads

Thank you for the quick response!

It seems that my composite tag code have never worked and always returned one of the values then, probably ModifyDate as it did resolve the original issue with the panorama images that did not contain the CreateDate tag.

This was what I had in my batch file before:


%EXIFTOOL% -if "$DocumentName ne ''" -d "%%Y-%%m-%%d %%H.%%M.%%S" "-filename<$MyCreateDate [$MyFileName].%%e" -overwrite_original -ext %PROCESS_FILE_TYPE% %PROCESS_DIR%


And thanks to your input this is what I have now:


%EXIFTOOL% -if "$DocumentName ne ''" -d "%%Y-%%m-%%d %%H.%%M.%%S" "-filename<$ModifyDate [$MyFileName].%%e" "-filename<$CreateDate [$MyFileName].%%e" -overwrite_original -ext %PROCESS_FILE_TYPE% %PROCESS_DIR%


It works perfectly well now without the composite tag at all. Both for the weird panorama files without CreateDate and for files with both CreateDate and ModifyDate for which I need to make sure CreateDate is always used as the ModifyDate can be wrong.

Thank you!

/Mads