Writing folder names into EXIF

Started by Knilch, December 10, 2014, 06:30:50 AM

Previous topic - Next topic

Knilch

Hello forums,

I would be glad to receive help on a solution for a very specific problem. The photos in question are organized in a directory structure several layers deep. The last folder always contains a number of photos.

Now what I would like to do is to read out that last folder name and write it into an EXIF field inside the photos it contains.

So for example the folder structure looks something like this:


  • Disney
  • Princesses
  • Arielle
  • Birthday Party

I want a program like exiftools run through all of the contents of the folder "Disney" with all its subfolders (there are many more princesses and many more events stored) until it gets to the photos and then look at the last folder the photo is in (in this example it would be "Birthday Party") to write that name into the EXIF information.

Does it make any sense? Is it possible to do that with ExifTool?

Phil Harvey

You could use a command like this:

exiftool "-imagedescription<${directory;s(.*/)()}" Disney

(the above quoting is for Windows.  Use single quotes instead of double quotes if you are on Mac or Linux.)

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