I always try to automate repetitive tasks, such as filing receipts and invoices. For exactly that reason I created a script using AppleScript to help with those tasks. Now I have discovered an even better way to do that using Noodlesoft’s Hazel. After download and installation, Hazel is accessible through System Preferences or through the OS X menu bar.
I use Hazel to automatically file (rename, move) the following files:
- Travel expenses
- Household receipts
- Tax-deductible receipts
- Pay stubs
- Invoices to pay
Before I can let Hazel do its job, I digitize most everything I get as a hard copy. When I’m at home or at my office I use a Fujitsu ScanSnap iX500* to wirelessly scan to my Mac and when I’m on the road I use an iPhone app called Scanbot. Either way, the scanned file ends up in a folder in Dropbox named Scan. This folder Hazel is monitoring for incoming files. In order for Hazel to be able to easily determine the file’s target location I’m prefixing scanned files:
- Household receipt: HH-
- Tax deductible receipt: TAX-
- Travel expense: EXP-
- Pay stub: PR-
- Invoice to pay: INV-
- Receipt: SEC-
Let me walk you through the rules I have set up by using my household receipts as an example. In Dropbox I have the following folder structure to archive such receipts:
Dropbox > Receipts > Household > 2014 > 05 – May > BestBuy_Dishwasher_2014_05_01_14_33_20.pdf
So I would like Hazel to move the scanned imaginary receipt HH-BestBuy_Dishwasher_2014_05_01_14_33_20.pdf into Dropbox/Receipts/Household/2014/05 – May/BestBuy_Dishwasher_2014_05_01_14_33_20.pdf while stripping the HH- prefix. I admit I haven’t spent a ton of time researching the most elegant way to carry out this task, but here is what I came up with:
1. Add Scan folder to Hazel
To add a folder click on the + button in the lower left and navigate to the folder Hazel should watch. In my case it’s Dropbox\Scan.
2. Create a rule that applies to files starting with HH-
Next, make sure the newly added folder on the left-hand side is selected and then click on the + button in the middle of the dialog to add a new rule. Configure the rule to look for files starting with the HH- prefix and move it into Dropbox\Receipts\Household.
3. Add Household folder to Hazel
Next, we’re going to add the high-level target folder (Household) to Hazel so it can watch it as well.
4. Create a rule for the Household folder
Inside the newly added Household folder we’re now going to create a rule that sorts files in the folder into the following sub-folder format: YEAR## – MONTH. For example 2014\05 – May. To do that we first configure the rule to look for files starting with HH-. Then we sort those files into sub-folders using a date-based pattern. So click on the “date created” pattern to add it, then on the folder separator (looks like an arrow) and then on the “date created” pattern again.
Now we have to change the patterns to get us the format we want. To do so click on the first “date created” to bring up the details dialog and then click on the downward facing arrow next to the first pattern. Choose “Edit Date Pattern” and adjust the pattern to show the 4-digit year only.
Do the same with the second date pattern to show the 2-digit month, space, “-“, space and the spelled out name of the month.
Last but not least add another rule (by clicking on the + button at the end of the rule you just created) to rename the file by removing the HH- prefix. You can leave the “name” “extension” pattern but we need to change the name pattern by clicking on it, in order to bring up the details view and then using the arrow down button to change the pattern details. Select “Replace text…” and replace HH- with an empty field.
At the end the rules for the Household folder should look like this:
Repeat the same steps for other file categories and feel free to change the rules to fit your environment. In case you wonder why I didn’t add the rules of the Household folder to the corresponding rule set of the Scan folder, the answer is that I discovered that the “Sort into subfolder” rule does not work well in combination with other rules.
For instance, I couldn’t find a way to add a “Sort into subfolder” rule to my Scan folder but apply the rule to the Household folder. If you find a better way to do this, please let me know by leaving a comment!