Downloads Organizing with Automator

KRV PERERA
2 min readJul 14, 2020

--

macOS Automator icon (from pngwing.com)

Inspired by a YouTuber I created a simple script to organize my downloads folder. I talked a little bit about the script in my previous story. This is the story of how I integrated it to macOS Automator. I am using macOS Catalina while writing this story.

First, open the Automator app. If you have already opened it you can choose File >New (or ⌘N). This opens a document choosing window. Choose “Folder Action” as the document type.

Document type choosing window of macOS Automator. File > New or ⌘N leads to this.
Document Choosing Window

In the opened folder action type document, choose the folder you want to organize. For this automation project, I chose my downloads folder. This action triggers every time I add files or folders to my Downloads folder. Next step is to add a script which runs for this trigger.

Choose the Downloads folder

Search for script action and choose “Run Shell Script” action. Automator will add a shell script window which will triggered by folder action.

Adding a python script

One issue I faced integrating the script in my previous post is that it is dependent on libraries. Therefore before integrating the script with macOS Automator I implemented all the library calls using native python methods.

Of course, there can be improvements to the script. Especially we don't have to go through every file for each trigger. As I don't expect an organized folder to have many files lying around I did not care about it much.

Finally, I added another script block to say aloud what was done. I really hope this won't bother me in the future :). Script says aloud the output of the previous script block.

print(“Moving {} to {}”.format(file, os.path.basename(newFolder)))

Everything is done! Enjoy downloading.

--

--