Rename & LR-compatible tagging based on filename

Started by clem, March 21, 2022, 03:41:35 AM

Previous topic - Next topic

clem

As part of my tagging and sorting adventure I have found a tool that will extract and add a wee bit of information to the stripped-down images that Meta's WhatsApp generates when pics are transferred to have more data to work with than the initial date of saving attachment to drive.

So now I have a structured filename...

YYYY-MM-DD HH MM SS - WhatsApp Topic - hex/uuid suffix.filetypesuffix

ex:

2018-05-27 01 42 31 - Mary & Joe - 72eb0766-666f-491c-a86d-c7ab515051de.jpg
2021-06-30 21 44 51 - Picnic Plans - e724bcf0-7f19-4fe0-b564-0c892f07f4c6.jpg


So given that I'm using Lightroom as a Digital Asset Manager I'd like to change the files so that the dates LR picks up are not the filename creation / modified dates but rather EXIF based data and also have LR pick up on keywords in the XMP side if possible so that based on the file name it would have:


  • add all date and time fields as per the original section of the filename
  • a keyword for the WhatsApp conversation such as "Mary & Joe" or "Picnic Plans"  - conversation title is always delineated by a [space]-dash-[space] on either side of the conversation title  i.e. - Mary & Joe -
  • add an additional keyword 'WhatsApp'

Is there a one-line version of this available to sic exiftool at the extracted attachments?

thank you!

StarGeek

To add the timestamps and as long as the format is as you show, you can copy the filename directly onto AllDates.  See FAQ #5, paragraph starting "Having said this".

The rest will need some regex to pull the keywords out of the filename. Assuming there are no previous keywords in the file, which is likely since WhatsApp strips metadata, try
exiftool "-AllDates<Filename" "-Subject<${Filename;m/ - (.*?) - /;$_=$1}" -Subject=WhatsApp /path/to/files/

Example
C:\>exiftool -P -overwrite_original "-AllDates<Filename" "-Subject<${Filename;m/ - (.*?) - /;$_=$1}" -Subject=WhatsApp "Y:\!temp\bbb\2018-05-27 01 42 31 - Mary & Joe - 72eb0766-666f-491c-a86d-c7ab515051de.jpg"
    1 image files updated

C:\>exiftool -G1 -a -s -AllDates -Subject "Y:\!temp\bbb\2018-05-27 01 42 31 - Mary & Joe - 72eb0766-666f-491c-a86d-c7ab515051de.jpg"
[ExifIFD]       DateTimeOriginal                : 2018:05:27 01:42:31
[ExifIFD]       CreateDate                      : 2018:05:27 01:42:31
[IFD0]          ModifyDate                      : 2018:05:27 01:42:31
[XMP-dc]        Subject                         : Mary & Joe, WhatsApp
"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