Hazel Mac Sync
Use a straightforward BASIC-like scripting language to automate your Windows GUI. To install Hazel: If you haven’t already done so, download the latest version of Hazel from the Noodlesoft website. Double-click the disk image file you downloaded. Read the license terms and click “Agree” to accept them. Double-click the “Hazel” icon. An “Install Hazel” alert asks where you want to install Hazel.
After years of struggling to keep my digital photo collection in order, I’ve finally reached a magical place. All my photos get automatically named, tagged, organized into subfolders on my computer, ready for Lightroom, and backed up in the cloud.
And when I say all my photos, I really mean all my photos. Photos from my DSLR, my iPhone, my iPad, and my wife’s iPhone. Photos from relatives, like my sister Rachel who often co-shoots family events. Even photos I’m tagged in on Facebook. (No joke). Along the way, videos are handled too, except they bypass Lightroom and get stored on my NAS.
I know, this sounds almost too good to be true.
But, if you’re willing to put in just a little upfront time to set it up, this system will save you massive time and frustration. When all your photos are where you want them to be all the time, you use them more. You enjoy them more.
I’m going to show you how to do it, step by step.
Ingredients of the photo management secret sauce
Before we dive into exactly how to set this all up, here are the components you’re going to need.
- A Mac. Sorry, I’ve got no PC alternative for this method.
- Amazon Cloud Drive (unlimited photo storage for Prime members) + oDrive (free). Other cloud storage services (like Dropbox, Box, etc) will work fine too. I’ve used this exact setup with SugarSync too. But, since Amazon offers unlimited photo storage with their Prime membership, I moved all my photos there. oDrive beautifully overcomes Amazon’s main limitation, which is that Amazon’s software doesn’t mount/sync as a folder on your computer. oDrive makes that happen.
- Hazel ($42). This magnificent piece of software is the real magic. Absolutely worth every penny.
- ExifTool (free). ExifTool by Phil Harvey is another sweet piece of software that we’re going to use behind the scenes. It is a really powerful command line tool (i.e. super nerdy and kind of hard to use). Don’t worry, I’ll give you the specific snippets you need to put this to work.
- PhotoSync (Pro Version $4.99) + PhotoSync Companion (optional, free). This is the awesome mobile app that automatically transfers new photos from any of my mobile devices whenever I arrive at home or the office (where the WiFi is fast). There’s also a desktop client (PhotoSync Companion) that can receive photos from your devices.
- IFTTT (free). This is a simply amazing app that connects your various online services like Facebook, Twitter, Evernote, Gmail, Amazon Cloud Drive, etc together. By setting up simple “If this, then that” recipes, you can create triggers to automate your digital life. IFTTT is the online service that stores each photo I’m tagged in on Facebook to my Amazon Cloud Drive account.
- Lightroom (multiple plans) or other photo app. When I started learning more about photography, I switched to Lightroom for my main photo management app. Although it is a bit expensive, it didn’t take long for me to fall in love and wonder why I hadn’t done it sooner. The tactics in this guide will work with any photo app that can synchronize to underlying photo folders. So, Lightroom isn’t the only option. It’s just the best one :-). .
Alright, with those tools in place, we’re ready to get setup.
In this walkthrough, I’m going to use Steps to describe how we’re going to set this all up, and Stages to refer to the phases of the preprocessing itself. To get the system in place, first we’re going to setup our folder structure, then we’re going to add our Hazel automation rules for preprocessing the photos, and then we can sit back and enjoy our photos.
Importing Hazel rules
To make this tutorial as simple as possible, I’m going to share with you the exact Hazel rules I use for acting on each folder in the workflow. Hazel rules are stored for each folder. I’ve packaged them all up into a zip file you can purchase right here.
Here’s how to use them in Hazel:
- Unzip the file on your computer. You’ll see several files with the extension
.hazelrules
. - In Hazel, right click on the Folder you’re interested in from the Folders pane, and select Import Rules and navigate to the folder where you unzipped the files. Choose the one appropriate for the folder you’re working with. Remember, all Hazel rules files will have the extension
.hazelrules
. - Review and edit the Rules as necessary for your workflow.
- When you’re done, be sure to mark the checkbox in order to enable the rule(s).
Cloud Storage
Once you have oDrive setup and connected your Amazon Cloud Drive, it’s time to get our basic folder structure in place. I use a top level Pictures folder as my starting point. Using oDrive is simple. Just use Finder to navigate to your Amazon Cloud Drive and create whatever top level folder you like. For me, the file path is:
Under Pictures I made two key subfolders:
- Personal. This is the main folder for all of our family’s photos. Inside are subfolders for each year: 2021, 2020, 2019, 2018, etc.
- Facebook. Here is where I archive pics I post (in a subfolder Mine) and photos I’m tagged in (a subfolder called Tagged). In case you’re wondering, no I don’t populate these manually…but we’ll get to that.
Local Computer
Photos are stored long term in the cloud for safe-keeping, but my local computer contains some working folders. These folders support different stages of the automation workflow. Having them on my local computer avoids lots of unnecessary syncing as the files are renamed and moved to different stages in the workflow process.
I keep all of the following folders inside the main Pictures folder of my user account. It’s the same folder name (Pictures) as is under oDrive, but this system default folder doesn’t get directly synced with the cloud. For me, the file path is:
Stage 1 – Custom Photo/Video Preprocessing
I have these subfolders for the preprocessing stage:
Note: I refer to this stuff as “Preprocessing” because in my mind, the real “Processing” of photos and videos happens in the editing software (e.g. Lightroom).
Stage 2 – Duplicate Checking
This stage is an optional intermediate step that is only necessary in big clean-up projects. For example, when I’m combining multiple copies of photos from old archives.
There are other steps in the workflow that also check for duplicates, but it doesn’t hurt anything to leave this stage in place all the time.
So these folders are:
Stage 3 – Move to final destinations
The final stage has transition folders for moving photos and videos to their permanent home. As you’ll see, I organize everything by date and this gives me one easy place to change the top level folder for current year:
Alright, here’s how we make the magic processing happen. Hazel is the secret ingredient.
Stage 0 – Collecting files from DSLR or other Cameras (Manual)
This part is still done manually, but it’s easy. Whenever I return from a shoot, I pop the camera’s SD card into my Macbook Air and launch Image Capture. (No, I don’t have one of those WiFi SD cards…yet). Image Capture is a handy program that comes with OS X. It’s a simple way to get photos and videos from stuff you plug into your computer (SD cards, phones, USB drives, etc). You can find it in your Applications folder. When Image Capture launches:
- Click on your SD card listed under Devices in the upper left
- Select the photos you want to import
- In the Import To selection at bottom of screen, choose your main import folder. In my case it is
Photos and Videos - 1 - Preprocessing - DSLR
. The first time you do it, the folder won’t appear as a choice in the Import To menu right away, so you have to choose to Other, then navigate to that folder in finder. - Click Import and the transfer begins.
Importing photos from an SD card with Image Capture
Side note: Image Capture is also an easy way to delete photos from your SD card when you’re finished.
Stage 0 – Collecting files from mobile devices
Automatic capture with PhotoSync
In my setup, photos from our mobile devices are automatically channeled into this workflow using PhotoSync. I have PhotoSync configured to transfer new photos from our mobile devices whenever we arrive at home and every night at 2:00AM if the device is charging. I know the WiFi is strong (and prepaid) at home, so I’m not worried about uploading large video files.
PhotoSync can transfer photos directly to many cloud services, but unfortunately, Amazon Cloud Drive support has been discontinued. Instead, I have PhotoSync setup to my main computer on the network where our workflow processing is happening.
If you’re transferring to your computer, you’ll need the PhotoSync Companion app installed. This program allows your computer to receive the photos from your mobile device. After installing, really the only thing you need to set is which folder it should store photos in:
Configuring PhotoSync on your mobile device is pretty straightforward too. Under Settings->Configure, scroll down to setup Computer. In the Computer configuration, navigate to the Destination Folder you created in Step 1. For my phone, this is Photos and Videos - 1 - Preprocessing - Mobile
. Having it create subdirectories is fine because we’ll setup Hazel to look down in child folders anyway. You can modify any of the other settings if you want. Here’s what my settings page looks like:
PhotoSync Target Settings Screen
Now that you have your target computer settings setup in PhotoSync, head back to Settings (click Done). Click Autotransfer to setup location-and time-based photo transfers. Here, I set my Target to be my Computer, say “Wait for Wi-Fi“, add the locations, and add a specific time that I want to trigger a sync. For me, my phone is set to connect to the WiFi at home, so I’ve added that location. I also want a nightly sync, so I’ve added a trigger at 2:00AM if the device is charging.
Mac Hazel Sync
Alright, that’s it for getting our mobile photos into the workflow.
Stage 0 – Collecting photos from social media (Optional)
This part of the gathering stage relies on the incredible IFTTT service. Once you have an IFTTT account, you have to setup two “Channels” – one for Facebook (or another social media service), and the other for Amazon Cloud Drive (or whichever cloud storage provider you’re using). After you have activated these two Channels, you create a recipe that connects triggers on one channel (social media) with actions on the other (save that photo).
If you’re using Facebook and Amazon Cloud Drive, you can just turn on this prebuilt recipe. The recipe tells IFTTT to watch your Facebook feed for when you are tagged in a photo, and if so, store it in Amazon Cloud Drive. When you turn on the recipe, just modify the folder path in Amazon to your liking. Mine is set to:
That’s it. Now you’ve got a copy of all those embarrassing photos archived in the cloud :-).
As a side note, I use another IFTTT recipe to make an archive of all the photos I post to Facebook. Since these are photos I take, they are already captured in the process we are working through. IFTTT is a convenient mechanism to remember which ones I’ve shared.
Setup Hazel to watch that cloud folder (synced to your computer via oDrive)
For these folders use Hazel rules: Photos and Videos – 0 – Collect social media photos.hazelrules
Now that we’ve got our social media photos stored in the cloud, add that folder from oDrive to Hazel’s folder watch list. Then, import the rules that scan that folder and copy any photos it finds into our pre-processing workflow. They’re placed in the Photos and Videos - 1 - Preprocessing - Social Media
folder). In my rules, I copy rather than move these social media photos (leaving the originals in that cloud folder). If you’d rather move them instead, just adjust the rule in Hazel.
Stage 1 – Photo and video Preprocessing with Hazel
Now, the real automated fun begins. We will setup Hazel to watch each folder and do the following:
- Use ExifTool to fix up dates
- Rename with my preferred pattern “date – pixel width x pixel height.extension”
- Use ExifTool to add tags
- Use ExifTool to reset modify date
- Move photos/videos to their final storage destination
Let’s walk through this for our three main types of import folders: mobile photos/videos, DSLR camera photos/videos, tagged photos from Facebook.
Mobile photo and video preprocessing
For these folders use Hazel rules: Photos and Videos – 1 – Preprocessing – Mobile.hazelrules
In this phase, Hazel is watching this folder (and its subfolders) on my local computer:
Photos and Videos - 1 - Preprocessing - Mobile
For simplicity, in this tutorial I am having Hazel treat all the photos in the subfolders with the same set of rules. If you want to have device-specific rules, you will need to setup these rules separately for each device subfolder. For example, you may want to label photos from different devices with different authors (people). It’s pretty easy to do. And once you do one folder, you can just drag and drop the rules to the next one. The only rule you have to modify is step 3 below, Add tags and keywords. But for now, let’s assume we’re going to treat all devices the same way.
1. Make the filename standardized and useful
Here we have Hazel use ExifTool to read the date information from the photo/video and make that the filename. To do that, Hazel runs a shell script to execute ExifTool to perform this action:
Hazel using ExifTool to add date and time to filename
Set color label
Hazel Mac Sync App
I use color labels just to signal that the file in being processed by Hazel. Red means “in process”. At the end, I set it to Green for “completed”.
Add photo dimensions to end of filename
To help easily distinguish hi-res photos when looking in Finder, I have Hazel append the photo dimensions to the filename. You can do this natively using Hazel’s powerful rename function. Here is the pattern I have it use:
This method keeps the date/time from the photo “created on” date that we added in the previous step. It just appends the dimensions to the end of the name.
2. Add tags and keywords
Here we use the same technique as above to have Hazel execute ExifTool with scripts.
Set “Author” in Exif Metadata
The first script sets the author information in the photo’s Exif data.
You might want to change “dan” to your name :-).
Set “Keywords” in Exif Metadata
The second script adds a keyword to in the photo’s Exif data to let me know this was a mobile photo.
These become “Keyword Tags” in Lightroom and can be handy for sorting photos. Yes, you could also use the Camera information, but I find this a helpful grouper.
Add Mac OSX tags
No script needed for this, but the last rule just sets a tag using Mac OSX’s built in file tagging mechanism. This makes the tags easy to use in Finder and other Mac programs. Currently, I just set a tag of “dan” to signal who snapped the photo.
3. Fix up the File Modify Date
When we use Hazel + ExifTool in the steps above, the operating system changes the File Modify Date. I’d rather have the Modify Date stay as the Created On date for now, because some programs use that Modify Date for sorting. This import process that we’re doing really isn’t important for that. So, a simple ExifTool trick re-sets the File Modify Date:
4. Sort Photos from Videos and move on to next step
In the last part of this phase, I have Hazel separate out Photos from Videos by moving them into different folders. Photos go into Photos - 2 - Look for Dupes
. Videos go into Videos - 1 - Look for Dupes
DSLR and other photo and video preprocessing
For these folders use Hazel rules: Photos and Videos – 1 – Preprocessing – DSLR.hazelrules
Here, we have Hazel watching the Photos and Videos - 1 - Preprocessing - DSLR
folder on my local computer. Just like in our Mobile photo and video Preprocessing step, Hazel has rules to perform the almost all of the same key actions:
- Make the filename standardized and useful
- Fix up the File Modify Date
- Sort Photos from Videos and move on to next step
The only difference is that I don’t set any tags or keywords for these photos. You could, but I just chose not too. This also lets me use this same pathway for importing photos from other people (who I wouldn’t want to tag with me as the author). Sure, I could setup a separate workflow for those, but let’s not go overboard here :-).
Social media photo and video preprocessing
For these folders use Hazel rules: Photos and Videos – 1 – Preprocessing – Social Media.hazelrules
Here, we have Hazel watching the Photos and Videos - 1 - Preprocessing - Social Media
folder on my local computer. I use exactly the same Hazel rules as in the DSLR photo processing. The key actions again are:
- Make the filename standardized and useful
- Fix up the File Modify Date
- Sort Photos from Videos and move on to next step
Stage 2 – Looking for duplicates (Optional)
I’ve build in a optional phase into my workflow that I use when processing a large set of photos that might have a bunch of duplicates. Before I had this magical system in place, I would occasionally make “dumps” of all the photos/videos on my phone. After copying them to my computer, I’d delete some of the older ones to save some space. Well, over time I accumulated several over these collections that had some unique photos in each one, but lots of duplicates. So, in this phase, all of those photos/videos are held up in a bin where duplicates are removed before they are moved to their final folder location. You can safely setup this stage, leave it in place all the time, and it won’t hurt anything. The “holding bin” folders are:
Look for and eliminate duplicates with Hazel
For these folders use Hazel rules: Photos – 2 – Look for Dupes.hazelrules and Videos – 2 – Look for Dupes.hazelrules
Here, we have Hazel watching the holding bin folders and have the “Throw away duplicate files” option enabled. The only rule in this step to Move the remaining files on to the Next step. When this rule is activated (checked), the photos move directly through this step. They aren’t held up at all. So, effectively this stage is disabled.
When the Move Uniques to Next Step rule is “unchecked”, Hazel does not move the photos along. They just pile up here. As incoming photos arrive, duplicates are tossed out. Once you’re ready to have them move along, simply check the rule again.
Stage 3 – Move photos and videos to final destination
After passing through de-duplication, the next stage is to move the photos and videos to their final destination.
Photos to Amazon Cloud Drive
For this folder use Hazel rules: Photos – 3 – Ready For Lightroom.hazelrules
At this moment, I have my photos stored under a central Personal folder in Amazon Cloud Drive. That folder is organized by year, and then by month. In Hazel, the rule for the folder Photos – 1 – Look for Dupes simply moves any photos to the current year folder on Amazon Cloud Drive. As a reminder, on my local computer, that folder has the full path under oDrive:
Hazel is also setup to watch that 2021 folder and organize it into months (e.g. 2021 01, 2021 02, etc). So, the first rule just dumps new photos in the root 2021 folder, and then this rule organizes everything that appears in 2021 into subfolders.
Videos to my Network Attached Storage (NAS) drive
For this folder use Hazel rules: Videos – 3 – Ready For NAS.hazelrules
I am not currently storing all my videos on Amazon. Those are stored on my local media server, a network attached storage drive (NAS). Having the on my local network is handy for streaming to computer with Plex hooked up to the main TV. The process is the same as for photos, just a different destination. If you are paying for Amazon Cloud Drive’s Unlimited Everything Plan, then backing up all your videos there would be a great idea. In Hazel, the rule for the folder Videos – 2 – Look for Dupes simply moves any videos to the current year folder on the NAS. Hazel is also setup to watch that 2021 folder on the NAS and organize it into months.
Now that you’ve got the comfort of a highly automated process, you can enjoy the rewards. In Lightroom, I have the Personal folder imported into my catalog. Whenever you fire up Lightroom and want to see the latest photos, all you have to do is secondary click (e.g. right click) on the folder of interest, and choose Synchronize Folder. Lightroom will automatically detect all the new photos in the underlying folders and add them to the catalog.
Hopefully you’ve followed the gist of the workflow and are on your way to photo management bliss. Obviously, there is a ton of room for customization. For example, over on the Noodlesoft forums, user “dhy8386” has a great post with a similar workflow that was a big inspiration for me. They have two additional steps in their workflow, which were interesting but not necessary for me. First is a review step where photos are not added to the main archive until they are manually reviewed and approved. Second, they have a python script for adding tags to photos from Finder.
Now that you’re equipped with this powerful photo management framework, have fun, experiment, and enjoy!
Disclosure of Material Connection
Some of the links in the post above are “affiliate links.” This means if you click on the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers. I am disclosing this in accordance with the Federal Trade Commission’s 16 CFR, Part 255: “Guides Concerning the Use of Endorsements and Testimonials in Advertising.”
Before I move on with this post, I'm going to make a couple of assumptions. I'm going to assume that you already understand that Hazel is an amazing application for macOS, that watches over folders in some form of virtual nanny-state, performing file actions on your behalf whilst you get that busy work done.
I'm also going to continue on the basis that you know about the awesome power of DEVONthink Pro Office, the Database/Paperless Office/Finder Replacement/All round swiss-army-knife-type-storage-app for macOS.
They are both amazing applications and I couldn't imagine having to live without either of them. However, after reading various forums and listening to some of my favourite podcasts, it seems that the general impression is that you can't have a workflow that includes them both. Using Hazel to rename files isn't possible within DEVONthink itself.
While the statement above is largely true, a small amount of lateral thinking can, however open up some possibilities.
I'm going to walk you through the setup I have employed to allow for the renaming of files with Hazel and subsequent import into DEVONthink Pro Office.
1) All files downloaded to my Downloads folder (the default)
2) Hazel watches this folder and automatically performs OCR on any PDF files that appear, using AppleScript and PDFPen Pro
3) These files are then renamed and moved to a Holding Folder I have in Dropbox.
4) Using the built-in Folder Actions for DEVONthink, a script runs on all contents of the folder. This script will Import, OCR and Delete the original file.
Dropbox Holding Folder
The first stage is to set up a Holding Folder. Now this Holding Folder has one purpose and one purpose only. It will perform a Folder Action that will Import a file into DEVONthink, perform OCR (Optical Character Recognition, making the contents of the document searchable) and Delete the original. This folder is the final place files will reside before import into DEVONthink.
The OCR that will be completed in this stage will be using the ABBYY Fine Reader Engine, arguably the most powerful OCR software on the Mac and built-in to DEVONthink Pro Office. We're going to be performing a 'lighter' (yet still powerful) OCR at an earlier stage, so as to rename the file effectively, however the final OCR will take place here.
Hazel Mac Sync Download
Why have I specified that this should be setup as a Dropbox folder? Well, firstly, any folder connected to a Cloud Service is fine (Google Drive, OneDrive, iCloud) - I just happen to use Dropbox extensively. Secondly, I find myself scanning and submitting business expense receipts from iOS a LOT. I use PDFPen Scan+ to scan the receipt, I rename with a TextExpander snippet before sending it directly to my Dropbox Holding Folder. When it reaches my Macbook, the Folder Action kicks off and the file is imported into DEVONthink.
Assigning Folder Actions
Assigning the Folder Action to your newly created Holding Folder is a simple process.
- Open Spotlight
- Search for Folder Action Setup
- Click the + button on the left hand pane. Navigate to the Holding Folder you wish to assign the action to.
- You will be presented with a list of scripts to assign. Select Devonthink - Import, OCR and Delete.scpt
Please note, you must have the scripts for DEVONthink installed. If you don't see any DEVONthink references in the box of assignable scripts, install them by clicking on DEVONthink Pro Office in the menu bar, select Install Add-Ons and tick the check box for Folder Actions Scripts.
Great stuff. You now have a folder that will act as a direct conduit between yourself and DEVONthink that is accessible from anywhere you have an Internet connection.
Hazel Mac Sync Free
Hazel Rules
OK. Now, we need to set up some Hazel rules. The question we need to ask ourselves, however, is where should these rules be applied? We've set up a Holding Folder, which is going to Import, OCR and Delete thanks to the Folder Action we assigned, yet this folder needs to be the last stop for the file - the final conduit between Finder and DEVONthink. Therefore I apply the majority of my Hazel rules to the default Downloads folder. These rules will carry out some OCR (using PDFPen Pro from Smile Software and subsequently rename the file based on the results.
I'll refer to you an earlier post on Date Matching with Hazel which runs through the process of scripting the OCR, looking for a date within the contents of the document and subsequent renaming.
The only part you need to add to the rule, in order to import into DEVONthink, is to move the file into your Holding Folder once renaming/tagging etc is complete. (Remember, DEVONthink recognises Finder tags, so you can use Hazel to pre-tag your files before they hit your DEVONthink Inbox)
You can make a lot of changes to the workflow above to suit your specific needs. I know that this works for me and apart from the odd tweak here and there, I'm very happy with how it runs.
Hazel Mac Software
There will be a video posted soon that walks through this process in finer detail - sometimes screencasts work better than text ever can, so watch this space and I'll let you know when it's ready!