Quick way to delete 'empty' imported Evernote notes

Got it, thanks.

Thank you all, from asking the question to providing useful answers.

For all those newbies that still struggle like me: it took me several hours to understand what happens and I will give some (hopefully useful) comments. However, a few things are still unclear. I hope the below triggers the experts and explains a few things for the beginners like me.

  • Pete31 explains it. If you follow his links then you first find a zip with the rule, and then the Applescript in the command above, which will need to be inserted into the rule.
  • The rule provided by @BLUEFROG contains a filter, choosing only documents with one outgoing link. Hence, it targets the text note (“Formatted Text” kind). Not sure whether this could be executed on the folder? That would simplify use (see point below)
  • As written by @pete31, you still need to set to right scope of the rule, because even if you trigger it on the right file it wouldn’t be executed if not in scope. For me that was the Evernote folder within the Inbox.
  • if you want to trigger it on a larger set you need to expand all folders (I only found the way of selecting all the folders and then pressing the right arrow key)
  • the two options of running the rules were confusing. But I understand it that applying the rule means it runs only for the selection. Performing the rule will deal with the full scope (as set by the rule definition see point above). So, try to apply it first a few times, then perform the rule if you chose as well the Evernote imported folder.
  • If you apply the rule on a test then it can very confusing as you suddenly only see the formatted note and no longer the PDF. That is because the PDF moved out and the formatted text note moved. If you look carefully then the view context did change! It can be now the trash or something related to a Tag. @BLUEFROG does that need fixing? Or can the tags be ignored?

You don’t have to use the tags if you don’t want. DEVONthink will import Evernote tags applied to the files you import.

Sorry, I guess I misformulated. I do want the tags. They are still valid. But I can still find the formatted note under tags, although the note itself went into the trash can. Is that as expected?


See here. The Formatted Note still “lives” under tags. That looks wrong.

No it’s not wrong.
Read Help > Getting Started > Tagging, especially the Ordinary Tags section.

Thanks again! I found this (couldn’t find the section you mentioned):

Basically, it says: it’s a feature, not a bug. But I don’t see the use of keeping the replicant under the Tags section. Hence, two questions arise:

  • Why would I want to keep this replicant under Tags? Is there something I don’t know?
  • Could you do more magic to remove the replicant as well?

Thank you! Much appreciated.

  • If you deleted the file, the replicant is removed.
  • If you deleted the replicant in the tag group, the tag is removed from the file but the file is preserved.

That’s how it’s designed and built.

Great, understood, even if unexpected. Would it be possible to change the script you created above in order to remove the tags from the files before you delete them? That way we don’t keep replicants that aren’t wanted. Or do I misunderstand something?

There won’t be any tag replicants after you’ve deleted the files and emptied the database’s Trash.

I cannot confirm. I still have it. Odd. Need to investigate.

Screen captures could be helpful.

ok, I got confused. Seems to be ok. Thank you. Impressive service, btw. Thank you!

You’re welcome and thank you for the compliment :slight_smile:

I applied the script successfully. However, I had too many notes where the rule didn’t work.
I have therefore duplicated the rule and commented out the if and end if lines with a # like this:


I gave it the name “Clean Evernote Imports!”.
After that I went to System Preferences → Keyboard and gave the resulting menu item a shortcut:

Now I can apply the rule easily when I get any of the many notes with the issue.

Note the first line of the script: On PerformSmartRule(TheRecords)
It’s a handler that’s triggered within Smart Rules
You will need to add a line for retrieving “TheRecords”, and triggering the handler

Thank you.

Well, I was only reporting my way as it took me a while to sort it out.
Yes, this rule is meant to be used on the current file only. The original rule did the majority of the work.

If I do something wrong: please let me know.

Add the line; tell application id “DNtp” to my performSmartRule(the selection)

Will gladly do. But it does work already. Is this line really needed then?
(Thank you in any case. Much appreciated that you try to help!)

I’ve downloaded the Rule and updated the script with the script posted further down the thread, but I still have problems with execution.

  1. I assign a group in the Database I want to “clean”.
  2. The SmartRule in the navigation bar shows it has found X matches (let’s say 40)
  3. I select “Apply the Rule” from the context menu and I see several notes crossed out (let’s say 4).
  4. I go back to the group and indeed 4 notes have been processed properly, but the remaining 36 are unchanged.

The remaining notes still show up as matches in the Smart Rule, but the Smart Rule won’t process them. Is there any log or other debugging mechanism which would allow me to check what is happening?

A sreenshot of the smart rule’s conditions & actions would be useful.