Automating ExifTool Output Using OS X


ExifTool, developed by Phil Harvey, is a handy tool for working with meta information. I primarily use it to view photo meta information without needing to load a larger application such as Photoshop. It’s platform-independent and free.

Rather than run the tool from a terminal or setup scripts, I decided to create an Automator Service. The service is launched by right-clicking on the source file and selecting the service. It then sends the file name and path to ExifTool, dumps the output to a text file, and opens the text file using the default system editor.

To set this up I installed the Mac package for ExifTool and then opened Automator and created a new Service that I named “exiftool”. Next, under the Library in Automator I added “Run Shell Script” to the Service.

For “Service receives selected” I chose “files or folders” and then after “in” I selected “Finder”.

In the “Run Shell Script” area I changed “Pass input” to “as arguments” and then entered the following code for the script:

for f in “$@”
exiftool “$f” > “$f”.txt
open -t “$f”.txt

The “$f” represents the file that will be passed to exiftool. This script saves the output to a file using the same name as the source but with a “.txt” extension appended.

Note that if you choose to adapt this code to a “Folder Action” you will need to modify it. Otherwise, it will get stuck in a loop by processing the first text file generated, thus creating a new text file, and on. Personally, I prefer using a Service so it will create the output in the same location as the source file.

If you need to find the Service to edit it (after it’s been created) you should be able to find it in user\Library\Services.

One thought on “Automating ExifTool Output Using OS X

  1. Ben

    Hey Michael, this is very useful, thanks!
    However, I’m a bit stuck.. I need to automate this line via exiftool

    -ext m2ts “-FileName<DateTimeOriginal" -d "%Y%m%d_%H%M%S.%%e"

    but can't seem to get it right…

    Can you help me? Please đŸ™‚

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s