Add Spotlight comments via Automator

Although I have an overall not-too-great opinion about Spotlight, it does have tremendous potential (more of which I hope we’ll see realized in OS X 10.5 ). For now, though, I don’t use it all that often. One thing I do use it for, however, is to fill in the Spotlight Comments box (in the Get Info window for any file or folder). I put things in here to help me identify, for instance, the purpose of a given program (“image sorter and viewer”) or to “tag” files and folders related to one project (“2004 site redesign”), even if they all live in different folders. I can then use Spotlight to search for these comments, making it easy to find exactly what I need.

While it’s relatively easy to add Spotlight comments to new files and folders as they’re created, what about the thousands of existing files and folders on your machine? While there’s no one solution that makes this a simple process, you can use Automator to ease the process when you have a bunch of files to tag with identical comments (the name of a client or project, your pet’s name, whatever).

Open Automator, in the Applications folder, and then drag these two functions into the work area, in this order:

  1. Library column: Finder, Action column: Get Selected Finder Items
  2. Library: Spotlight, Action: Add Spotlight Comments to Finder Items. Leave the Append to existing comments box checked, and click the disclosure triangle next to Options and check Show Action When Run .

When you’re done, it should look like this:


Now select File: Save As Plug-In, give your plug-in a meaningful name like Add Spotlight Comments , leave the Plug-in for pop-up set to Finder, and then click Save. You’ve just created a Finder plug-in to help you mass-add Spotlight comments.

To use your new plug-in, switch to the Finder and select any number of files and folders (using Shift and/or Command to make the multiple selections as necessary). Control-click on one of the selected files and choose Automator -> Add Spotlight Comments (or whatever you named your action) from the pop-up menu. Soon a dialog box will appear where you can enter your desired comments; type the text you’d like to add and click Continue. That’s it; the workflow will then add the specified text to each selected item’s Spotlight Comments field.

Using this workflow, it’s relatively easy to add Spotlight comments to many files at once. Once “tagged,” you’ll then be able to use Spotlight to quickly zero in on exactly the files you’re after.

  
Shop Tech Products at Amazon