Reading the “Where From” meta data using Keyboard Maestro

I was recently presented with this problem. I had dozens of files that had very generic filenames that needed to be sorted. However, the “Where From” meta data contained useful information about the author and content. Problem is, how to use that data?

After searching around, it’s possible to read that information using something similar to:

xattr -px com.apple.metadata:kMDItemWhereFroms '/Users/name/location/location/location/filename.ext' | xxd -r -p | plutil -p -

That’s great, but not exactly useful. But once again, Keyboard Maestro comes to the rescue and can handle the problem with ease. In fact, it doesn’t really require coding, the functionality is all built in.

The first step is to use the Get Attribute action, and set it to Where from. That is then stored in a variable and you can manipulate things as you like. I used the Switch/Case statement to have Move/Rename files based on the name it found.

This is then nestled inside a For Each and you just keep adding more conditions to the Switch statement.

What looked like a rather convoluted process turned out to take no more than a couple of minutes using Keyboard Maestro. When done, I was able to organize dozens of files using different, but completely valid information.

Another win for Keyboard Maestro.

km-where-from

If you’ve come as an elf, see it through as an elf.

Author Signature for Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.