Inconsistent results when moving files with same name?

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

Moderator: Mr_Noodle

I have two similar, but different (nested) rules set up for moving files with the same name, depending on the extension. The only difference between the two rules is the extension on the nested rule (within both main rules). Depending on the extension, I'm getting different results. These are the file names that are placed into the folder that Hazel is monitoring:

regular_photo.heic
regular_photo.aae (the sidecar for the above photo)
live_photo.heic
live_photo.mov (the video of the above live photo)

The two rules on the folder that Hazel is monitoring is as follows:

RULE 1
Code: Select all
If all of the following conditions are met:
    Name matches FILE_NAME (FILE_NAME is a "• Custom Text" pattern with the attribute set to "... Anything")
    If all of the following conditions are met for ANY FILE OR FOLDER IN THE SAME FOLDER
        Name matches FILE_NAME
        Extension is aae

Do the following to the matched file or folder:
    Move to folder SIDECARS


RULE 2
Code: Select all
If all of the following conditions are met:
    Name matches FILE_NAME (FILE_NAME is a "• Custom Text" pattern with the attribute set to "... Anything")
    If all of the following conditions are met for ANY FILE OR FOLDER IN THE SAME FOLDER
        Name matches FILE_NAME
        Extension is mov

Do the following to the matched file or folder:
    Move to folder LIVE_PHOTOS


The only difference between these two rules is the extension being matched in the nested rule (aae/mov), and where the files get moved to (SIDECARD/LIVE_PHOTOS folder).

The problem I'm having is, when I drop all four files into the folder being monitored, Rule 1 moves both live_photo.heic and live_photo.mov into the LIVE_PHOTOS folder. But Rule 2 only moves regular_photo.aae into the SIDECARD folder, and live_photo.heic is left in the folder being monitored.

I've also tested this using a single rule and just changing the extension between attempts (either aae or mov), but still getting the same results. When I match against the aae extension, only the aae move. And when I match against the mov extension, both the heic and mov move.

Any ideas on why I'm getting these different results?

Running Hazel 5.3.6 on macOS Monterey.

Thanks,
Kristin.
kristin
 
Posts: 27
Joined: Tue Apr 10, 2012 12:34 pm

Can an heic have both an aae and mov file? Is there a reason you don't specify heic as the extension in the conditions? If you have a.heic, a.aae and a.mov at the same time, a.mov will match the first rule.
Mr_Noodle
Site Admin
 
Posts: 12058
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Can an heic have both an aae and mov file? Is there a reason you don't specify heic as the extension in the conditions? If you have a.heic, a.aae and a.mov at the same time, a.mov will match the first rule.


I don't know/don't think an heic can have both (aae and mov); but I'm not trying to work with an heic that has both. I have an heic that has an aae (regular_photo.heic & regular_photo.aae), and then another heic that has a mov (live_photo.heic & live_photo.mov). So, ignore the mov part, for now, and let's just use these two files:

- regular_photo.heic
- regular_photo.aae

But, you're correct...I should be checking for the heic extension in the initial match condition. I misunderstood how the matching worked on nested rules; I had assumed it was matching both files (the heic from condition 1 and the aae from the nested condition 2, but I was incorrect in that; the match results only apply to the matched file found in the initial match rule (as long as the second match condition is met).

So, now I have this rule:

Code: Select all
If all of the following conditions are met:
    Name matches FILE_NAME (FILE_NAME is a "• Custom Text" pattern with the attribute set to "... Anything")
    Extension is heic
    If all of the following conditions are met for ANY FILE OR FOLDER IN THE SAME FOLDER
        Name matches FILE_NAME
        Extension is aae

Do the following to the matched file or folder:
    Move to folder SIDECARS


This now results in the correct heic being moved to the correct folder. But, this leads me to another question (should I start a new thread?)...I'm trying to move BOTH files (the heic AND the related aae sidecar) into the folder. Is there a way I can get both files moved into the sidecars folder? The only thing I can think of is to add a second rule which then finds all aae files and moves them into the SIDECARS folder. Something like this:

RULE 1
- find HEICs (initial match condition) that have related AAEs (nested match condition)
- move matched HEIC to SIDECARS folder

RULE 2
- then find all AAEs (just a simple match condition based on extension)
- move all AAEs to SIDECARS folder

This would seem to technically work, but it would leave room for error (as rule 2 is just moving all the AAE files; it doesn't use a nested rule to match against anything because the HEIC file has already been moved, so there's no file to match against).

Is there a better way to go about this?
kristin
 
Posts: 27
Joined: Tue Apr 10, 2012 12:34 pm

You might be able to do a multi-phase thing where you tag the files first, then move all the tagged files though I think what you have might work well enough.

I have considered a feature of specifying sidecar files that move along with their main file but not sure what all the expectations would be for such a feature. For example, would it only be for moves? How about copies? Or if one is tagged, should the other be tagged? etc.
Mr_Noodle
Site Admin
 
Posts: 12058
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Yeah, not sure how much need there is for this; I know there have been a number of questions like mine for this purpose (archiving photography). Accompanying files for Sidecars (aae) and Live Photos (mov) are the two instances where you run into this issue. The worflows (like mine, above) work great the majority of the time.

There was an edge case with the aae files—sidecars could have a different creation date vs the photo (as edits to the photo may have been made at a later date/time). This became an issue when you sorted into subfolders based on create date and/or time. But, I noticed (not sure when this happened as I haven't actually looked into this in a while) that the aae files creation date/time now match the original image creation date/time. I just edited a photo from 2 weeks ago, used Image Capture to download to my desktop, and the aae that was just created has the same creation date as the photo itself. So, Apple seem to have solved that problem.

So, I don't know if it'd be worth the development time if there are way to get this done already (even if it takes an extra rule or two).
kristin
 
Posts: 27
Joined: Tue Apr 10, 2012 12:34 pm

I'm definitely open to the idea if it makes things significantly easier and it happens frequently enough. By posting your workflows that may need this, that helps me determine if such a thing is needed or not.
Mr_Noodle
Site Admin
 
Posts: 12058
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

OK, so ran into an issue with with my proposed workaround. Here's an example of a similar situation where I'm trying to my an HEIC and it's related MOV (when dealing with live photos).

I want to match MOV and HEIC when they have the same name, and move both into a LIVE_PHOTOS folder.

RULE 1 (find HEIC files that have the have a MOV with the same name, move into LIVE_PHOTOS)
Code: Select all
If all of the following conditions are met
    Name matches FILE_NAME (FILE_NAME is a "• Custom Text" pattern with the attribute set to "... Anything")
    If all of the following conditions are met for ANY FILE OR FOLDER IN THE SAME FOLDER
        Name matches FILE_NAME
        Extension is mov

Do the following to the matched file or folder:
    Move to folder LIVE_PHOTOS


And here's the problem. I can't just move ALL remaining MOV files into the LIVE_PHOTOS folder, because there may be MOV files that aren't related to Live Photos. And trying to match the MOV against the HEIC won't work because the HEIC has now been moved to a new folder. And from what I can tell reading the Rules/Nested Rules documentation, there's no way to match my MOV files against the HEICs that have already been moved into the the LIVE_PHOTOS folder.

So, I'm unsure how to deal with this?

Instead of moving, I can TAG the files:

RULE 1 (find HEIC files that have the have a MOV with the same name, tag as LIVE_PHOTO)
Code: Select all
If all of the following conditions are met
    Name matches FILE_NAME (FILE_NAME is a "• Custom Text" pattern with the attribute set to "... Anything")
    If all of the following conditions are met for ANY FILE OR FOLDER IN THE SAME FOLDER
        Name matches FILE_NAME
        Extension is mov

Do the following to the matched file or folder:
    Add tag LIVE_PHOTOS


RULE 2 (find MOV files that have the have a HEIC with the same name, tag as LIVE_PHOTO)
Code: Select all
If all of the following conditions are met
    Name matches FILE_NAME (FILE_NAME is a "• Custom Text" pattern with the attribute set to "... Anything")
    If all of the following conditions are met for ANY FILE OR FOLDER IN THE SAME FOLDER
        Name matches FILE_NAME
        Extension is heic

Do the following to the matched file or folder:
    Add tag LIVE_PHOTOS


But, I still need to sort these files into subfolders. Adding a third rule to move, based on the tag won't work because the process never gets there (as, once a file is matched against a rule, it moves onto the next file; and if I get around that by using “Continue matching rules”, then I run into my original issue (with the HEIC being moved, so the MOV has nothing to match against).

Feel like I'm in a bit of "rock and a hard place" situation? Or am I missing a way to deal with this?
kristin
 
Posts: 27
Joined: Tue Apr 10, 2012 12:34 pm

You could try putting a delay on moving things. Tag the files and maybe a rule like "Date last matched is not in the last X minutes and tag is XXXXX, move/sort to YYYY"?
Mr_Noodle
Site Admin
 
Posts: 12058
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support