Write the current folder name into the tag

Started by Peter G, May 31, 2023, 11:05:12 AM

Previous topic - Next topic

Peter G

Please, asking for help!

I need to put the folder name where the images are stored to some IPTC tag no matter what, keywords, for example, in order to enable search in these images.

How to accomplish this?

🫶

Phil Harvey

exiftool "-subject<directory" DIR

where DIR is the root of the directory you want stored.

Here I've used XMP:Subject instead of the older IPTC:Keywords to store this.

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

Peter G

Dear Mr. Harvey,

Thank you for your answer! I got this with one folder 🫶

How should I act in case if I have hundreds of folders with hundreds of subfolders to achieve this - that is to write the folder name into the Subject field?

I have to do this because the XnView MP Quick Search does not support the search in the subfolder names.

Please, help! 🙏🙏 spent the whole day in the internet, but even the ChatGPT could not help )

Peter G

ExifTool -overwrite_originals -r "subject<directory" PARENT_DIR