Am I correct that "match patterns" cannot help here?

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

Moderator: Mr_Noodle

Hello all!

Just want to confirm the following – hoping to prevent me falling down a rabbit-hole unnecessarily, in trying to kludge something together that is not possible to kludge! :P

What I'm wanting to do:

Dump a PDF into a root-folder, have Hazel look at the UNIQUE number sequence in the filename – find an already existing sub-folder with that same UNIQUE number sequence in its sub-folder name, and drop that file into that sub-folder.

Details:

I work inside Devonthink, that indexes a root folder inside Finder containing hundreds of sub-folders, named [First-name Surname_Client-Number].
The files inside those sub-folders, are mostly PDFs downloaded from our CMS, or 'printed' from Outlook.
(I realise that I can send directly into DTPO - but for a variety of reasons, the files must first be placed into Finder, which DTPO then indexes).

So I do the following:

a.) New client – manually create a new sub-folder inside the Root Folder, using the [First-name Surname_Client-Number] naming regime.
a1.) If the sub-folder already exists, ignore the 1st step.

b.) Save PDFs off my CMS system/PDFs out of Outlook, of emails pertaining to that client, into that Client's sub-folder.

Each PDF has a particular type of naming regime (using TextExpander), but the unique identifier within that filename, is again the Client's [First-name Surname] and [Client-number].

So the filename of those PDFs could be "DD-MM-YYYY_Consultation1_Floaty McFloaty_123423432" OR "DD-MM-YYYY_Email received_Query on Sale_Floaty McFloaty_123423432" etc.

This works fairly well, since with Default Folder X, and Keyboard Maestro, quite a few steps are removed from the process.
But obviously, IF Hazel can auto-sort the PDFs, then a major friction point will be removed (mainly due to the number of steps involved between a.) and b.), involving selecting where to place the Files etc.).

Why I doubt Hazel can help:

If I understand "pattern matching" correctly, then Hazel looks for
Code: Select all
(text) (text) (text) (text) (text)_(digit) (digit) (digit) (digit)
or some-such combination. In other words, understandably, a pattern... So Hazel doesn't, or rather cannot(?) look to see what the content of the pattern is, correct?

Or is there something that can be done to tell Hazel to "watch all in this folder – if a Filename is dropped into it, where this part of the filename MATCHES this part of a sub-folder name inside the Root folder – then move that File into that Folder".

I would be gob-smacked if this was possible. Not at all a criticism of Hazel, which is obviously extremely powerful, but can only (understandably) work within certain predictable 'fields'. Regardless, figured I would just check!

Many thanks!
Cassady
 
Posts: 47
Joined: Wed Mar 06, 2013 4:34 pm

Do you really need to check if a subfolder exists with that name? What happens to files that don't?
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Do you really need to check if a subfolder exists with that name? What happens to files that don't?


Appreciate the reply!

I might be misunderstanding why you are asking - but 'yes'(?).

Essentially, I have the Root "Client" folder, and inside of it - hundreds of sub-folders for past/existing clients.
If a 'new' client contacts me, I create a new sub-folder for them.
Over time, many different PDFs (emails/documents/CMS fact-sheets etc.) will end up in each of those different client sub-folders.


So today, I might 'generate' 30 PDFs - all named with the TextExpander snippet, together with the client's [Name Surname_Unique Client-number] as filename - and I will manually sort these into the already existing sub-folders for those clients.
Most of those will go into sub-folders created for clients earlier this week/month/year, or even several years ago - some will be new clients, and I might have created their folder earlier today.

What I was hoping to do, was to simply drop the PDF into the main root folder - have Hazel find the sub-folder with that client's name, and put/move the file into the right folder...

So it is a 'match' situation, but the text string is a name+surname OR unique 11-digit code, which must be matched against an existing sub-folder Name, for Hazel to move the file into there...

Hope that makes more sense?
Cassady
 
Posts: 47
Joined: Wed Mar 06, 2013 4:34 pm

Right, but why create and file manually? The "Sort into subfolder" action will create folders as needed. My previous question of non-client files applies. If only client files go here and will all get sorted, then I don't see a need to check against an existing folder.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Right, but why create and file manually? The "Sort into subfolder" action will create folders as needed. My previous question of non-client files applies. If only client files go here and will all get sorted, then I don't see a need to check against an existing folder.


Ah - I am with you now.

So Hazel’s “Sort into subfolders” will be able to work off the name_surname or unique number as a “pattern” in the filename?
I honestly thought it would only be able to pick-up specific combinations of numbers_symbols - not examine the content thereof??!

Has that always been possible??
Cassady
 
Posts: 47
Joined: Wed Mar 06, 2013 4:34 pm

I'm not sure if I understand your question, but if you create custom attributes in your match pattern, you can then use those attributes in your Sort into subfolder pattern. So, create a custom attribute to match the customer name and go from there.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:I'm not sure if I understand your question, but if you create custom attributes in your match pattern, you can then use those attributes in your Sort into subfolder pattern. So, create a custom attribute to match the customer name and go from there.


Many thanks. I will go and try some experimenting, and see what I can find up with.
Cassady
 
Posts: 47
Joined: Wed Mar 06, 2013 4:34 pm

Pleased to say that I managed to get what I need, working. :D

Just made a few adjustments to my TextExpander naming system, so as to better define something recognisable in the filename for the purposes of the matching pattern – and will now work a bit through my existing sub-folders to get them named appropriately as well (for the sorting going forward).

Shouldn't take me too long - and at least I will not need to sort manually from here on in.
Cassady
 
Posts: 47
Joined: Wed Mar 06, 2013 4:34 pm


Return to Support