Skip to content

Haydn Williams Blog

  • Outdoors
  • Current Page Parent Photography
  • Travel
  • UK
  • Gigs

Edit metadata – Bash scripts

26th March 2008 Haydn Williams Photography

I recently wrote about using ExifTool to edit the metadata stored within your images, particularly in relation to that information which is displayed in Lightroom. When I’m working with my images, I have a set of shell (BASH) scripts that I use to add or amend metadata, and I thought I’d make them available for other people to look at for inspiration, or even use if you find they meet your needs. For example, to add a title to the metadata of a specific image, I would run the following in a Terminal window:

$ img_title.sh "This is my title." myphoto.jpg

To add the same title to all the images in a directory, I could type:

$ img_title.sh "This is my title." -all

There are a couple of things to note when using the scripts:

  1. This is all done on a Mac. If you’re on Windows then I’m sorry. If you’re on Linux, I guess this should work, but I’ve not tried it.
  2. I’ve assumed that you’re comfortable running shell scripts in a Terminal; if you’re not happy doing this then I’d suggest you might be better either using Lightroom to manage your metadata, or investigating one of the graphical front ends for ExifTool.
  3. These scripts are designed specifically for my own use; it’s highly unlikely that they’ll be perfect for what you need straight away. Feel free to modify them yourself if you want (but please keep the header, including my website URL, intact).
  4. The scripts don’t just add information to those fields which display in Lightroom, they add it to as many fields as is possible / relevant. For example, the EXIF:XPTitle field is not displayed anywhere in Lightroom, but the img_title.sh script still adds your title to that field anyway.
  5. You can get an example of how to run each script by just running it without passing any arguments at all. Further information about each script can be found in the header at the top of the file  (just view the file in Terminal, for example).
  6. To install the scripts, just unzip the downloaded file (see below for the link), and move the entire folder to /Library/Scripts. Then add the following line to your ~/.bashrc file: 
    PATH=$PATH:/Library/Scripts/metadata

You can download a zip file containing all the scripts here.

Tags: commandexiftoolMetadataScriptshellTerminal

  • Next Notts Today Article
  • Previous Lightroom metadata with ExifTool

2 Responses

  • Comments2
  • Pingbacks0
  1. Tilo says:
    29th April 2008 at 02:24

    Lots of good info, I liked the Lightroom table. Just wanted to comment on your EXIF:XPTitle example, though. Windows XP actually does not process XPTitle if ImageDescription is also present. You have to remove ImageDescription if you want XPTitle to work.

  2. Dick Haight says:
    19th January 2016 at 19:34

    I work as a tech volunteer for a local historical society. We’ve scanned a few K historic pictures & would like add descriptive comments that “stick” to the image files. The subject matter expert is not a techie. I’d like to make a drag/drop app that does the following:

    1. drag/drop image file on app winddow
    2. prompt for comment text (more than 1 item)

    then I’ll execute exiftool–
    % exiftool -Comment=”text from 2. above” “file-from-1.-above”

    Suggestions?

Lightroom metadata with ExifTool
IT Photography

Lightroom metadata with ExifTool

  • 24th March 2008
Sync folders to network drive
IT

Sync folders to network drive

  • 2nd December 2010

© Haydn Williams 2014-2025