ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: nuttybacon on October 11, 2019, 11:08:01 AM

Title: Using parent directory name as -Title within jpg
Post by: nuttybacon on October 11, 2019, 11:08:01 AM
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

Title: Re: Using parent directory name as -Title within jpg
Post by: Phil Harvey on October 11, 2019, 11:11:44 AM
Try this:

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

- Phil
Title: Re: Using parent directory name as -Title within jpg
Post by: nuttybacon on October 12, 2019, 06:48:48 PM
Thanks. Worked a treat.