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 “$@”
do
exiftool “$f” > “$f”.txt
open -t “$f”.txt
done

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.

The disk cannot be partitioned because some files cannot be moved.

The Short Version: A Boot Camp partition that had been removed left modifications that needed to be cleaned up. The solution was to boot from an install disc (Snow Leopard at the time) and run “Repair Disk”. It found errors and corrected them. I also repaired permissions (again) but I think running “Repair Disk” is what fixed the problem. I was then able to run a “Full Defrag” using iDefrag.

I recently decided to add a Windows partition to a Mac (OS X 10.6) system via Boot Camp. This was the second time. Windows had been previously installed and then removed. Unfortunately, every time I ran the Boot Camp Assistant to repartition the Mac I received the following error:

The disk cannot be partitioned because some files cannot be moved.

I tried running iDefrag in Full Defrag mode. That didn’t work. Next, I moved a large Parallels VM image to a USB drive, deleted the original, and then restored it. That also didn’t work. After reading some more suggestions I ran iDefrag again but this time selected the “Compact” option. It didn’t work.

Ultimately, I think the problem was caused by previously having a Boot Camp partition installed, which made some writes to the startup device that were not removed the first time the partition was removed.

What appears to have corrected the problem was to boot from a Snow Leopard install disc, open Disk Utility, and run the “Repair Disk” command. It did find errors and corrected them. After that completed I also repaired permissions, but I’ve done that from the OS previously and doubt it contributed to fixing the problem.

Once the disk was repaired I was able to successfully use Boot Camp Assistant to repartition the drive and install Windows.