iPad Guild

Doing More With iPad

OS X Tip: Use Automator to Backup & Move files

Since the delivery of my Nifty Drive, I have been looking for the easiest and best way to backup or move files automatically from my downloads folder to my Nifty Drive. Just a way to keep them in sync without much trouble or even having to remember.
I set out looking at third party apps, scouring the App Store for something simple to possibly do the chore. Then some fine folks over on Reddit pointed me to Automator.

Automator is a tool that allows you to “record” or script simple tasks and make them automatically happen for you.

Automator is your personal automation assistant, making it easy for you to do more, and with less hassle. With Automator, you use a simple drag-and-drop process to create and run “automation recipes” that perform simple or complex tasks for you, when and where you need them.

Knowing nothing about writing scripts or even how to go about using Automator, I took some time to ask around, search for other’s who had the same problems as I did. I found some answers pretty fast. The main thing I wanted to do was use an Automator application to copy files to my Nifty Drive.

I found what I wanted and I want to walk through the process so you can see how easy it really is to copy files from point A to point B without any heavy lifting.

Let’s get started by launching our little robot friend Automator. Make sure you pick Application when you see the open dialogue.

automatorapplication

Once open you will see a section on the right to paste the following code in. Make sure you select Utilities from the Library section, then Run Apple Script.

automatorunscript

Paste the script below into the window.

tell application “Finder”
set source_folder to (choose folder with prompt “Choose the source folder:”)
set target_folder to (choose folder with prompt “Choose the destination folder:”)
if source_folder is not target_folder then
set the_files to every file of source_folder
repeat with each_file in the_files
set file_name to name of each_file
if not (exists file file_name of target_folder) then
duplicate each_file to target_folder
end if
end repeat
else
display dialog “Choose different folders as source and target!” buttons {“OK”} default button 1 with icon stop
end if
end tell

Once you have the above code pasted in, hit the green Start button. This will bring up a finder dialogue box asking what your source folder. Select the folder you want to copy files from. Then it will ask you for the target folder. It’s that easy.

For my workflow and what I wanted to accomplish, I went a step further and decided I wanted to run this script for two folders. So I just duplicated the code and changed the folder paths. See screenshot below. Notice how I had to add the full path of the folder with quotations and ending colons.

automatorscript

Once this is done, we need to do a few more things. After saving the application, I decided I wanted the folders to “sync” when I logged in. To be able to do that you need to add it to your Login Items.

You can get to your login items by:

  1. Open System Preferences
  2. Navigate to Users and Groups under the System section
  3. Click the Login Items button on the top
  4. Click the + button to add your application
  5. Within Terminal type is: chflags nohidden ~/Library to unhide your user library so you can navigate to your application
  6. Your application by default will save to /Users/YOUR USERNAME HERE/Library/Workflows/Applications/Folder Actions/Name of your App.app

automatorloginitem

Now when I start up my lovely Macbook Air, this script runs quickly, behind the scenes and my folders are in sync. I don’t worry about ever having to remember to copy files or make them sync up.

This was definitely a learning experience for me but now that I know more about Automator, I will be playing with it more to accomplish small tasks that save me time in my daily workflows! Hope this helps you!

About Matthew Snider

Get your free 18 Must iPad Apps Guide

[mc4wp_form id=”3825″]

Leave a Reply