Wednesday, June 23, 2010

'Move' with automator

Automator : Create automations without programming

As simple as it might be, yes automator is a over looked, under estimated tool available in Mac OS X. 
Any one with no programming knowledge too can with point-and-click knowledge can create workflows to achieve almost anything. Although personally, I'd recommend it as a great tool for repetitive tasks such as renaming, etc! Or some task that's not repetitive in a single stretch but something that you might perform now and then like backing up your data, etc.

Here are the basics. You create a workflow that's more like flow chart. Top to bottom, the actions that you define are executed, with one's output being sent to the next on the line.

Actions are categorized on the left most (library) pane, shown in the screenshot below. The actions under the selected category are in the pane to the right of it.

Nothing gets easier than using an example: the one that I quoted in my previous post: Moving files under multiple folders into a single folder.


In our scenario, the folder named 'Jdownloads' contains 11 folders named as

Ubisoft E3 2010 Conference [Part 1 of 11] - Child of Eden(HQ)
...
Ubisoft E3 2010 Conference [Part 11 of 11] - Michael Jackson The Game

The contents of these must be moved to 'E3 Conference'. A mundane task that I hate to do with all those mouse clicks or key board hits (I mostly use the keyboard). Whichever way, I HATE to do this!

So define the 3 actions shown in Fig. 1. 
  1. Find Finder Items     ---- (A1)
  2. Get Folder Contents ---- (A2)
  3. Move Finder Items   ---- (A3)
A1:
This action can be customized with the search options it provides. It under the hood just uses the 'search' Mac provides. So am gonna just search for the 11 folders. How do I do that? 

Look under the Jdownloads folder, for 'folders' that contain the text 'e3' in the name. The action and it's results on single-stepping are shown below. Don't be flabbergasted by the result: 12 folders. The extra 12th is the output folder. No harm done. It's empty anyway :)



A2:
Iterate through all the folders of the previous result and get their contents. In this case, 1 file in each foler adding up to 11 files.



A3:
Move the items to the specified folder!

As simple as that. Now, I could've also deleted the source folders after the move. But why don't you just try that, hands-on!


No comments:

Post a Comment