Automator Workflow – Just Move Files From Subfolders

QArea Expert by QArea Expert on June 29, 2011

Automator Workflow – Just Move Files From Subfolders


Handy though folder structure of Mac may be, there can be times when you burry files in plenty of layers of folders which they it is not easy to find any more or deal with. For example, you can have a nest of old notes or photos or a decade’s worth of tax documents. Although you can wade through those folders manually to bring your to the surface, along with an Automator app you may make it all with an easy drag and drop. That the example which way:

Workflow set up

Launch Automator (Applications) and into the template chooser which emerges, select Application. Then add these actions to your workflow in such an order: Set Value of Variable (located under the Utilities heading), under Files and Folder heading find Get Folder Contents, Filter Finder Items (within Files and Folders), also in the Files and Folders Filter Finder Items and Move Finder Items to Trash.

Choose Set Value of Variable as the first action and select New Variable from the Variable pop-up menu. In the open window Variable Options enter an intuitional name as for example hostFolder and click Done. In the Automator select View -> Variables. Then there should appear your hostFolder variable in the list of variables at the workflow at the bottom.

Within the second action – Get Folder Contents – empower the Repeat For Each Subfolder Found option. Configure the next Filter Finder Items action to interpret Kind Is Not Folder. In the following action – Move Finder Items – just drag the hostFolder variable from the variables list at the foot of the workflow to the To pop-up menu so as its name emerges in the pop-up menu. Empower the option Replacing Existing Files in this action. Leave the following Get Folder Contents action as it is – without the option the Repeat for Each Subfolder Found checked. Then configure the following action Filter Finder Items to read Kind is Folder. And ultimately, leave the action Move Finder Items to Trash alone. Next name your workflow as for example “Subfolder Zapper” and then save it into the Desktop.

How to put it to work

While you drag a folder on to the applet of workflow, all items that are concealed in folders within that folder will be located at the root level of the dragged folder. So, for instance, if you drag folder X that includes Folders Y, Z and W – to the workflow, the files that are within these folders (together with the contents of the folders in those folders) will shift to Folder X. Then the workflow goes on to remove the empty Folders Y, Z and W.

Remember that the workflow works appropriately only in case you drag at a time one folder to the applet. Moreover, be warned that in case you have duplicated names of files, the files with duplicate names will be deleted.