Moving old versions by observing version number

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

Moderator: Mr_Noodle

Moving old versions by observing version number Wed Apr 29, 2026 6:59 am • by asher
Hi folks!

I work in post-production and am new to Hazel.

When creating new versions of a video, I move the previous iteration into a folder named '_archivable'. If there are multiple deliverables for a project, they will be exported to the same place, with all of their previous iterations moved to the '_archivable' folder.

I've managed to set up automation for the first example in Hazel. If the 'Kind' is 'Movie' and the Date added is not among the 1 most recent, then the file gets moved to 'archivable'. The issue is, if I have to export multiple deliverables then this command will shove everything into the archive folder other than the last deliverable on the export list.

Is there a way that Hazel can match a file name and observe that a version number has changed, and then act upon that change?

The naming convention for files remains exactly the same between deliverables, other than the very last digit which is the version number. So for example *CLIENT CODE-DELIVERABLE CODE-Title-Resolution-v#'.

If I have a bunch of exports that are labeled as v1, and then re-export another bunch then labelled v2, I'd love all of the v1's that match those file names to be moved to the archive folder together. Would love to hear if there are any solutions!

Thanks :)
asher
 
Posts: 1
Joined: Wed Apr 29, 2026 6:48 am

You can try using match patterns (consult the manual) to grab the version number. The problem is I'm not sure if there's a good way to do comparisons. Hazel does not have a way to extract a number as a number, but just as text. You could do it if you used a script that would compare the version numbers but other than that, not sure how it would work outside of that.

An alternative is to go by the date. If you add a condition to pattern match the name alongside the "Date is the 1 most recent", the latter condition will only apply to files that match the other conditions. The issue is designating a "series".

You could try something like the following:
Code: Select all
   If (all) are met
      Name matches <<<pattern>>>
      If (all) are met for (any file in the same folder)
          Name matches <<<pattern>>>
      Date added is not among the 1 most recent


There's a lot to unpack here. Again, I refer you to the manual for match patterns and for nested conditions.

The pattern would need to be something like (• series name)-v(number) where (• series name) is a custom text attribute which can match any text. That will match all the text up to the "-v#" part and store it. In the nested condition, when you create the pattern, re-use the (• series name) attribute. What that does is the first time it matches, the name gets stored there. When it hits it the second time, it has to match the same name as the first time. This is how you establish matching a series of files with a similar name.

The other part of this is that when you have other conditions at the same nesting level as a "is/is not among", it filters what files apply to that condition. So, your date added condition will only apply to the files that match the other conditions. So it will match all but the most recent file in that series.

I suggest playing with it on some test files so you can figure out how all the pieces fit together.
Mr_Noodle
Site Admin
 
Posts: 12198
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support