How to run a search on different date formats


I have been quite inconsistent with my dating conventions in file names (and also within text but that’s a problem for another time!). Since this forum and some other forums I lurk on have gradually this year convinced me that I really should standardise my dating, I’ve decided to adopt the standard that is mentioned here which I think is the ISO universal format: YYYY-MM-DD (I’ve chosen this standard as it will not be subject to my whims)

I have half-heartedly started applying this as I amend notes, and then I realised I was being daft because DT can probably find all the files that have dates in their name. I don’t normally do very technical searches though and I don’t know how to communicate to Devon what I need it to search for. In addition I write dates in a number of ways, I assume I will need to run searches on each of these separately?

So, please can someone show me how I ask Devon to scan across my database for occurrences of dates in file names? Is that a thing that is possible?

E.g. if some files are named “Apples 01.01.2020” how do I tell Devon to look for the “01.01.2020” with wildcards? (If it matters, I also don’t put the date in a consistent place, sometimes it’s the prefix sometimes it’s the suffix!)

Whilst I usually use a combination of numerals with either forward slashes or full stops, less frequently I also do this:
DD month YYYY
I can see this one in particular might be difficult for a computer to parse, and when I’m very annoying I might write a shorthand which is a British convention I think, e.g. 10th Apr 21, which I’m assuming Devon won’t be able to identify at all because I have no idea how I’d search for that? (At least numbers are vaguely consistent!)

I don’t want Devon to amend these files, I’m a bit nervous about automating that, so for now I’d just like to work out how to find all files with a type of date in them, which I can then look at and amend accordingly. So I think that means I need the search function and not a smart rule, because I don’t want Devon to do anything with the files it finds.

I actually wondered whether it’s even worth doing this, given that as a human I understand what date I’ve written no matter what format I wrote it in. But having it non-standardised like this means I can’t even tell you how many dated files I have because I have no way of searching! Plus the organiser in me thinks this is a bit of a shambles and I should use dates consistently.

Like this [0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]. Or just [0-9][0-9]-[0-9][0-9]-202[0-9] if the years include only 2020, 2021 & 2022.

1 Like

You’re a star, thank you! And comparing the Search Operators guide with your answer means I now understand what you’ve done too and I can do it myself :slight_smile: Thank you.


I have a similar problem. I spent most of my life in Britain too and date formates drive me insane. My own solution was to use snippets in Keyboard Maestro and ONLY date files using the triggers. That is sort of working over the last five years anyway. I use the Year then month then day order as that orders them properly chronologically in my system. There is no way I could stick to my system with automatic snippets. One of the best uses and an unsung one for textexpander, Keyboard Maestro etc.
As we speak I start to wonder if DEVONthink 3 has some inbuilt way of doing this?

As we speak I start to wonder if DEVONthink 3 has some inbuilt way of doing this?

Of adding dates to filenames in DEVONthink?
Indeed and often discussed on the forums :slight_smile:

1 Like

as always Jim, thanks.

You’re welcome. Nice to see you here again :slight_smile:

1 Like

I use an Applescript to process inbox files, which includes setting filename
My naming standard is prefixing with the date (yyyy-mm-dd)

1 Like

I had a very productive evening running various searches to find all the date formats I’d used in file names and correcting them manually (by choice, I know Devon could do this).

All my files are now formatted correctly. As @tudoreynon notes, the problem is now making sure I do this to future files! I will for now rely on my brain - many of my files are related to academic papers so are named following that convention (author, year, title). I’m very intrigued by a ‘hot key’ that fills in the date automatically when I need it though, so I’m off to research that!


Are you referring to files your importing or creating that you want to insert the date into the name?

I left this in my subconscious today and came up with a solution, and I see you have posted a question that I think was going to lead me to the same solution!

Since I’m not very good with hot keys, and DT is my only file repository (or will be once I finish moving everything), I found myself wondering “why don’t I just ask DT to give the filename the correctly formatted date”. This brought me back to my original conundrum of inconsistent date usage. BUT, I am older and wiser now, and it occurred to me that if I just stuck a keyword in place of date in a filename, I could set up a smart rule that told Devon to correct it when it finds this keyword! Then I don’t have to write dates at all!

I have figured out how to use placeholders (yey), but I got stuck on one bit, please can you help? The smart rule runs when I write “DATE” at the end of a file name, but it doesn’t delete the word. So currently a file named Apples DATE then becomes Apples DATE2022-04-20. How do I tell DT to delete the word “DATE”? I thought scanning the string would identify the bit that needed changing but I am guessing the “name” placeholder is telling Devon to put the whole name back in? This is my smart rule:

If it’s simple can you explain which bit I did wrong so I understand for next time.

Also, the manual says that searches are case insensitive. Is this true for the smart rule criteria too? I would prefer that the smart rule searches for an exact case sensitive match, but I don’t know if I can make it do that (this would ensure that any file that legitimately ends with the term “date” would be excluded, e.g. a file named “Bank mandate” or something.

Thank you!

1 Like

Yes the norm is for search and operations like the one shown here to be case-insensitive.

Use * DATE, noting the space between the two, in the Scan Name action.
And instead of the Name placeholder, insert the Document String placeholder.

1 Like

Ahhh I missed the “document string” placeholder. Now corrected and it’s working perfectly, I’ve also added the space you recommended so the rule doesn’t run in error.

Thank you very much for your help :blush:

You’re very welcome :slight_smile:

The next release will add a new placeholder and a new default smart rule to simplify this (and a Scan Name > Date > * action isn’t supported currently either):

1 Like

That’s cool, thank you :blush: