Update EXIF comment with current base directory

Started by jowe, July 08, 2015, 06:22:59 PM

Previous topic - Next topic

jowe

Using exiftool 9.98 under Windows 7 - I am trying to write the base directory (not the entire directory path) into the EXIF comment without any success.
Command: exiftool -r -Comment="%%:d" -charset "FileName=Latin" TOP_LEVEL_DIRECTORY\
As a result exiftool writes the text %%:d into the comment.

Maybe I'm doing something that has to be done in a completely different way.

I would be glad if somebody can help me.

Best regards - Jo



Phil Harvey

Hi Jo,

The %d etc only work when writing FileName or Directory.

You need to use the advanced formatting feature to do this.  Something like:

exiftool "-comment<${directory;s(.*?/)()}" ...

This will remove the top level directory name.

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

jowe

Hi Phil,
thank you very much for your immediate response - it did it!
One simple question remains: instead of writing to '-Comment' (Exif.Photo.UserComment) what would I have to use to write to '-Exif.Image.ImageDescription'?

Your quick help was and still is very much appreciated.

- Jo

Phil Harvey

Hi Jo,

Quote from: jowe on July 09, 2015, 03:17:55 PM
One simple question remains: instead of writing to '-Comment' (Exif.Photo.UserComment) what would I have to use to write to '-Exif.Image.ImageDescription'?

I'm sure you can guess the answer.  Hint: ExifTool uses colons instead of periods as separators if you are qualifying a tag name.  The qualifiers (ExifTool group names) are optional, and order doesn't matter, so pretty much anything you guess should work.

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

jowe

Hi Phil,
it did'nt work well - it worked very well.

Once again, many thanks for your help.

- Jo