Compare two date fields in Smart Groups?

How would I approach a Smart Rule that would compare two standard date fields on a document?

For instance, If I wanted to find all of the PDFs where Created Date is the same as Added Date (or within a day of each other), would that only be able to be done via scripting? If so, how?

I doubt that’s possible with a smart rule. A script could find them, but afterwards…?

Smart rules don’t do such comparisions. It matches specified criterion.

And according to your query, you need a smart group not a smart rule because you’ve defined no subsequent actions to be taken.

Ah. So I was using the wrong terminology.

Is there a way to search for PDFs that have the same created and added date, whether it’s through Smart Groups, AppleScript, or other methods? The example above is good if I download and import on the same day, but that is not all the time. Plus I still have a lot leftover from my first months working with the product.

One could script it. Something like that

  • Find all PDFs not tagged with “myUniqueTag”
    • For each of them (currentPDF)
      • tag it with “myUniqueTag”
      • find all PDFs not tagged with “myUniqueTag” whose creationDate and addedDate are the same as for currentPDF
      • move these files to a special group
  • Remove “myUniqueTag” from all PDFs
  • Delete the special group with all its contents (or whatever you want to do with these files)

But: Identical creation and added dates do (in my mind) not mean identical content. What are you trying to achieve?

When I download PDFs, it inherits the Finder date info. So if I download it on Monday, it has a Created Date of Monday, even if it was created in 2020. Most of the time I import the day I download.

I have created a basic AppleScript here that can extract the “real” date metadata so I can organize by date.

DEVONthink 3.9 introduced the new hidden preference UsePDFDocumentDates and therefore the script isn’t necessary anymore.

1 Like


So when I run
defaults write com.devontechnologies.think3 UsePDFDocumentDates -bool TRUE
(DT3 is off)

It still imports with Finder date. Am I activating it wrong?

Zip and post the PDF.
What date do you expect and from where did you extract it?

Here are two reports that I downloaded today. They will always show up with today as created and modified until I change them. I have tried Global Inbox, copying, and moving from Finder.

IDC (701.3 KB)

Did you attach those to your support ticket ?

After enabling the hidden preference and importing the files via drag & drop the dates are the expected ones. How did you exactly add them to the database?

Multiple ways:

  • Drop in Global Inbox folder
  • Drag from finder to database’s dedicated Inbox
  • Drag directly in to database

The bundle identifier is actually com.devon-technologies.think3.

That is very cool feature. I never knew about it.

Does this also work for already indexed files, or should I re-index them after I enabled in the hidden preference?

Preferences, no matter whether hidden or not, do not affect already imported/indexed material, therefore you’d have to import/index them again.

1 Like

OK, I will do that.