Using parent directory name as -Title within jpg

Started by nuttybacon, October 11, 2019, 11:08:01 AM

Previous topic - Next topic

nuttybacon

Hi,

I want to add a title to my pictures based on the folder name they reside excluding any other parent folders.

If I run this

EXIFTOOL -r "-Title<${directory" "C:\Temp\Christmas 2018"

the meta title meta data is added as 'C:\Temp\Christmas 2018'

I only want to add Christmas 2018

I have a Picture structure like this (below is just examples)

I want to run this exif tool command on the parent 'Pictures' folder. I don't want to run on every single folder.

so all pictures within Holiday Cyprus (picture 111 and picture 222) will be given a title of Holiday Cyprus and not c:\pictures\holidays\Holiday Cyprus and so on. Hope this makes sense.

Pictures
-Holidays
--Holiday Cyprus#
---picture 111.jpg
---picture222.jpg
--Holiday Italy
---picture 333.jpg
---picture 444.jpg
-Christmas
--Christmas 2018
---picture 555.jpg
---picture 666.jpg
--Christmas 2017
---picture 777.jpg
---picture 888.jpg


Phil Harvey

Try this:

exiftool -r "-title<${directory;s(.*/)()}" DIR

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