Page 1 of 1

partial matches of name and existing subfolder?

PostPosted: Mon Aug 08, 2016 3:42 am
by MiB
Is there some native way of matching a file where only a partial is the same as a string in an existing subfolder that the file is sorted into, instead of Hazel creating a new one?

I have an existing subfolder structure with hundreds of folders of unique serial numbers. In the parent folder an external process is adding files and the file names also contain the same serial numbers. What I need is to match up the file with serial number as xxxxx: "Lots-of-variable-text(xxxxx)" with an existing folder: "Project-xxxxx-Lots-of--other-variable-text". Seems like something very typical to be able to do.

I'm thinking there might be a simple way to at least get the serial out of the file and folder names — which are partial strings — and match them with applescript, but maybe there's even an existing native way to do partial matches?

Re: partial matches of name and existing subfolder?

PostPosted: Mon Aug 08, 2016 2:11 pm
by Mr_Noodle
Provided you are running a recent version of Hazel, in the Sort into subfolder action, there's an "anything" token which you can use. So, if you set up a custom attribute to capture the partial string, then you can then re-use that in the Sort into subfolder pattern. For the parts outside of the custom attribute, you use the "anything" token. That will match an existing folder with that partial string.

Re: partial matches of name and existing subfolder?

PostPosted: Mon Aug 08, 2016 5:30 pm
by MiB
Mr_Noodle wrote:Provided you are running a recent version of Hazel, in the Sort into subfolder action, there's an "anything" token which you can use. So, if you set up a custom attribute to capture the partial string, then you can then re-use that in the Sort into subfolder pattern. For the parts outside of the custom attribute, you use the "anything" token. That will match an existing folder with that partial string.


I assume you mean version 4? If so, time to upgrade.

Re: partial matches of name and existing subfolder?

PostPosted: Tue Aug 09, 2016 11:41 am
by Mr_Noodle
Yes, sorry. Should have been more specific. I suggest running it in trial mode first so you can make sure it's what you want before purchasing the upgrade.