Deleting Duplicate Files

You’re welcome :slight_smile:

You should still set the “All” instead of “Any” for “of the conditions are true”. In your case with “Any”, you select all documents (which includes all duplicated ones) and then you run a rule for only some of them (those you marked) which moves duplicates to the trash. Since your rule selects also non-duplicated documents, the script ignores those. Which lets you think that it’s not working.

Put differently: “Any” is equivalent to “or”. Selecting “any document” or “duplicates” therefore selects “any document”, aka all of them.
“All” is equivalent to “and”: “any document” and “duplicates” therefore selects only duplicates. If you go for only one condition, namely “duplicates”, all should be fine as well.

That is a very helpful thread - thanks all for insights.

My question is the following - is there a way instead of deletion to actually substitute existing files?

The current way described above, how I understand it and based on my tests, deletes the duplicate from a folder in which I run the script, let us call it folder “Incoming”. If I have a folder where duplicates of this file lives, let us call it “Existing” is there a way based on:

to substitute the existing file in the database (the “old one”) with the new (the “last imported one”).

The use-case is some of the files which “return” to Devonthink from some 3rd party software (like Goodread) with annotations, and in this case I would want to preserve this copy but want to delete an existing one in the Database.

Looking on all the actions in smart rules, I do not seem to find an appropriate one. There is “classify”, but I am looking for classify + rewrite based on the duplicate :slight_smile:

Classify: Using our AI, this will attempt to move any matched files to an apropos location. Failures to classify files are noted in the Log window.