File Name, scan Filename and custom metadata

Hello,

I’ve read the topic 3.8: custom metadata no longer created by smart rule and Update custom metadata fields from filename - #6 by Indigosans but not sure to understand if I can drop this using “Scan Name”.

I would like to fill 3 different custom metadata using File name.

File name is : “COMPANY - YYYYMMDD - Objet”.

Is it possible to do it without a script?


ile name.

You can do that with a Smart Rule using regex.

  • Scan Name | Regular Expression | ([^\-]+)\s+\-\s+(\d{8})\s+\-\s+([^\-]+)
  • Change theCompany to | \1
  • Change theDate to | \2
  • Change theObject to | \3
1 Like

Alternatively
(.+?)\s+-\s+(.+?)\s+-\s+(.+?)
With non-greedy quantifiers. If the file name is always as described, no anchor (^) needed, either.

But: What’s the point in duplicating information from the file name into metadata? Who’ll update the metadata if the file name changes and vice versa?

I’m glad to be corrected! TIL.

I’m not the OP but I use a variation on this to handle receipts I add to DTTG from my phone. Because Custom Metadata isn’t available on iOS I format the name in a similar manner (vendor date amount) and then in DT I run a smart rule to extract the information into Custom fields and file into groups. I personally dislike files names that are full of data like that instead of being more descriptive so I simplify the name as part of the smart rule.

1 Like

Hello,

I absolutely don’t know what is Regex but anyway thank you for reply!

TY for reply.
Most of files will be as described. But some will have some more details. I will have to check.

But: What’s the point in duplicating information from the file name into metadata? Who’ll update the metadata if the file name changes and vice versa?

Because I have near 2x1000 files from 2 different sources. to mix. One from mine (including metadata) and other from external data without. And I’m using metadata to create rules etc.

Same for me.
I would have more simple file name but IOS can’t handle metadata for smart rules, so I need full text name to find data.

Finder Comments are supported in both DEVONthink and DEVONthink To Go.

Noted for future investigation.
I will say though, when using scanning apps and texted/emailed receipts, when you’re balancing a phone on a darkened and quiet set or in the chaos of an all-hands meeting with people thrusting little bits of paper at you, I have found the most frictionless and flexible method is to format the name as “Vendor Date Amount” and sort it out later.

See for example regex101.com

gskinner’s RegExr is a fun tool too :smiley:

So complex to me

Regex seems not understandable at the moment.
I absolutely don’t know where to put the regex and what happens to convert regex to metadata

Thanks to chatgpt I’m now able to understand how to is structured because I have to many thing to do I can’t learn something like this

For the first time I find a real thing to do with chatgpt!
now I need to try by myself

Hi,

I do not understand what is how to set this :

  • Change theCompany to | \1
  • Change theDate to | \2
  • Change theObject to | \3

regex101.com would have told you the same. But of course without the fancy AI label.

And, \s+ is not „a space“, as ChatGPT states. But then it would have to know something instead of mindlessly stringing words together.

1 Like

You are right about chatgpt.

Edit : It is ok now Scan Name and Change are working