How to stop Hazel from re-processing files

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

How to stop Hazel from re-processing files Thu Aug 16, 2012 6:36 pm • by Bonanzan
I'm setting up rules to extract PDF invoices that have been received in Apple Mail. As I build this set of rules I would like to extract not only new invoices that come in today but also extract previous invoices that match the rule.

I have been successful in configuring the first two rules (2 different vendors) I've created to work perfectly to accomplish the desired task. The problem comes when I make a change to one of the rules or add a new rule to the group of rules that watch the mail folder and subfolders. After the addition or change Hazel frequently re-runs the rules from the beginning and creates many duplicate files that I don't want. I have the "do not copy if duplicate" setting checked in multiple places in the process but still get the duplicates. I would like to continue adding new rules to this folder's set for additional vendors without generating duplicates for all of the previous matches.

Yesterday I had an issue (unrelated to Hazel) that required me to boot in safe mode, fix the problem, and then restart normally. After the restart, Hazel again started these Mail rules from the beginning and added a full set of duplicates to my filing system.

How can I stop Hazel from re-processing files that it has previously matched successfully?
Bonanzan
 
Posts: 10
Joined: Sun Jul 01, 2012 1:02 pm

Normally, if a file matches the same rule over and over, it will only run the actions the first time. If you change a rule, it will re-fire because it is now different. Hazel can't know whether you mean to change it only for future files or are changing it to correct something. Not sure about the safe mode issue but if something happened to your system where the files matched a different rule (or no rule at all) and then matched the original rule again, it would re-fire.

You should try configuring the rules so that they won't match again. The best way is to move the files somewhere else (have a separate folder for processing and done). Other options include coloring the file.
Mr_Noodle
Site Admin
 
Posts: 7759
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks, Mr_Noodle for the prompt reply.

I have been changing the rules to do a little "tweaking", which will cause the rule to re-run. (Question: Does creating a new rule which runs on the same folder trigger Hazel to re-run all of the rules for that folder?)

I thought I understood (through trial and error) how to make the process work correctly. I am already using both an extra processing location and some color coding as you suggested. However I am still getting duplicates. The thing I don't get is why Hazel copies a duplicate version of a file even though the "Do not copy if a duplicate" option is checked. I have that option checked on each step of the operation.

In one location the "Do not copy" is checked along with the "replace" button. This is in my processing folder. If I watch the folder as Hazel runs I can see that Hazel is replacing the file with a new copy of the file. These file names are the original ones and Hazel has not yet been asked to rename them. Although the name of the file doesn't change I can watch this taking place because I have the the file being colored yellow when it's placed in that folder and changed to grey once it is matched and a copy of the file is moved to the destination folder. Because it is replacing the file and not renaming the new one I don't end up with duplicates in the processing folder. But, because the file changes, Hazel then runs a separate rule on the processing folder to put a copy of the new file in the destination folder. Why would Hazel be replacing the file in the first place if the "Do not copy if a duplicate" option is checked?

The rule for copying the file from the processing folder to the destination folder also has "Do not copy if a duplicate" option checked, but with the "rename" button selected. In this case Hazel still copies the file over but appends the -1, -2, etc. to the end of the file name. Hazel must think the file is a duplicate if it is automatically renaming the file, yet it seems to be ignoring the "Do not copy if a duplicate" option which is checked.

Writing this all out has made me think of a new question . . . Would Hazel consider a file to NOT be a duplicate if the files were identical with the exception of the highlight color? I was color coding the files as they move around so that I could better follow what Hazel was doing. But if this is the cause of Hazel not knowing that both files are actually duplicates I may have to remove all coloring. I would hate to do that just as an experiment unless you think it is necessary, as the coloring is what makes it easier to identify and remove the duplicates when they are mixed in with everything else. And that's something I have had to do frequently.

I could send you the rules if you think you need to look at them. Or, I will run any test you think I should.
Bonanzan
 
Posts: 10
Joined: Sun Jul 01, 2012 1:02 pm

There are two things going on here: whether a file has the same name as one that is already at the destination and whether it is a duplicate. Those are two different things.

A duplicate is an exact copy, which means that it is byte-for-byte identical to the other file. In such cases, you can opt to not do the copy since the exact file exists already at the destination.

For the other options, it's for files with the same name which aren't necessarily duplicates. In such cases, you can specify whether to copy over the one that is there (regardless of whether they are duplicates) or rename it so you don't lose the other file. I suggest taking another look at your rules with this in mind.
Mr_Noodle
Site Admin
 
Posts: 7759
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: How to stop Hazel from re-processing files Sat Mar 09, 2013 10:52 am • by HirnHorn
I've been trying different approaches to this problem and have come up with my personal favourite solution:

In the rule that processes my files I insert a condition:

[Comment] [does not contain] [whatever]

and then I insert the action:

[Add comment] with pattern: [whatever]

That way every file is processed once and will not be processed again. I personally use "filed" instead of "whatever".

This only works if ALL of the conditions are met for the files or folders.
HirnHorn
 
Posts: 3
Joined: Tue Mar 05, 2013 2:34 pm
Location: Hamburg (GER) and London (GBR)


Return to Support

cron