How to concatenate directory and filename in IPTC field with "Exiftool-shortcut"

Started by Willy Dufour, April 11, 2019, 01:43:48 PM

Previous topic - Next topic

Willy Dufour

Hello,
I want on source files (raw) write in the tag [IPTC:Source] "the directory" and "file name" with a shortcut "Exiftool".
(example of final data "FileAdress\FileName.raw")
I have the solution for separate fields [...\exiftool.exe -k -IPTC:Source<Directory -L] and [...\exiftool.exe -k -IPTC:Source<FileName -L], but not concatenating them.
What is the code to concatenate these two fields (directory and file name)?
Thanks a lot for your help.
Willy
Windows 7 and 10
Exiftools ver.11.2.6.0

StarGeek

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Willy Dufour

Hello,
I had already tested your code without success.
With your code, in the field "IPTC: Source" I have the directory without the file name [... / 2019 / 2019-03-24_D500].
(my test file name is "DSC_0010.NEF")
Best regards,
Willy
Windows 7 and 10
Exiftools ver.11.2.6.0

StarGeek

Can you copy/paste the full command and results here? In the CMD window you can drag to select and then hit enter to copy to the clipboard. Paste it using the CODE button above  

Here is my result.  The backslash might be changed to a forward slash for consistancy.
C:\>exiftool -P -overwrite_original "-IPTC:Source<$Directory\$Filename" -L y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -g1 -a -s -IPTC:Source y:\!temp\Test4.jpg
---- IPTC ----
Source                          : y:/!temp\Test4.jpg


Another option might be to use the FilePath tag instead, though that will output the full filepath even in cases you want only part.
C:\>exiftool -P -overwrite_original "-IPTC:Source<Filepath" -L y:\!temp\Test4.jpg
    1 image files updated

C:\Programs\My_Stuff>exiftool -g1 -a -s -IPTC:Source y:\!temp\Test4.jpg
---- IPTC ----
Source                          : y:/!temp/Test4.jpg

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Willy Dufour

Hello,
Solution solved, thank you for your help.
Sorry (basic lack of computer vision), it was a problem of field length "IPTC: Source" = string [0,32]
By changing the tag "IPTC: SubjectReference" = string [13,236]+, the problem is solved.
With the code [... \ exiftool.exe "-IPTC: SubjectReference <$ Filepath" -L], the result is [directory\filename].
Next time, I will be attentive to this parameter.
My greetings
Willy
:) ;)
Windows 7 and 10
Exiftools ver.11.2.6.0

StarGeek

Ah, my apologies for forgetting about that limitation.

You can override that by adding the -m (ignoreMinorErrors) option to write a string of any length to IPTC:Source.  Another option would be to write to XMP:Source, which can accept long strings, if your software supports it.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Willy Dufour

Hello,
Thank you for this detail "-m".
I prefer the tag [IPTC:Source] to [IPTC:SubjectReference], more visible on my software:
The tag [IPTC:SubjectReference] is visible in "ViewNX-i ver.1.3.2" (Nikon), "Gimp ver.1.10.8" and "XnViewMP ver.0.93.1".
The tag [IPTC:Source] is visible in "ViewNX-i ver.1.3.2"(Nikon), "Gimp ver.1.10.8", "XnViewMP ver.0.93.1" (64bits), "Lightroom ver.6.14" (Camera Raw 10.1) and RawTherapee ver.5.5" (32 characters).
Greetings,
Willy
Windows 7 and 10
Exiftools ver.11.2.6.0