Quick way to delete 'empty' imported Evernote notes

Brand new DEVONthink user here, fleeing Evernote after 12+ years. First day in and I’ve imported my notes in DT (super easy, thank you team) and I’ve worked out that the “Clutter-free Formatted Note” option in the web clipper is very similar to the my beloved Evernote “simplified article” save (DT being the only web clipper I have found in over a year of searching to come close, thank you again team). Looking forward to exploring more, and waiting to buy DTTGo until the new version is released so I don’t pay twice in short order.

One thing that would help enormously is any tips on how to remote the ‘empty’ notes which come with an Evernote note with attachments: i.e. if the note was only an attachment (and a title), then a DT group is created with the attachment and a note with just the title and a link to the attachment.

I understand and appreciate why they are created, but I would love to automate the manual process of dragging the attachment out of the group (i.e. up a level) then deleting the ‘empty’ note and group. I can do it manually but I have thousands of them. Groups are also sorted separately to the single-file notes (again, I understand why, I just want to decompose and optimise). I’m sure I’m not the only person to have wanted to do this so is there any tips, features, or AppleScripts that will help me please? Many thanks in advance!


Should be possible via AppleScript, however you didn’t tell enough about Evernote import to test.

  • What type is a imported “note”? HTML?
  • How exactly does a “note” whose only content is its title and a link look like? (Please post its source, see below)


  • use menu View > Document Display > Source View
  • copy the source

In your post use

  • three backticks
  • a new line
  • paste the source
  • a new line
  • three backticks



You didn’t mention renaming the attachment, if it isn’t renamed with the group’s/note’s name you’ll loose that info, I think. So I guess it should be renamed?

Welcome @jeep

You mean this…

to this…

1 Like

Yes sir. I’ve figured out I can probably do something with a smart group to show the attachments (which are all properly named and identical to the name of the original note, because they were all uploaded with Hazel + Applescript) but wondering if there’s a better way.

Well, as I wrote it’s easily done in AppleScript. However as you didn’t post the source of such a note I couldn’t write that script.

Try this… Unzip and double-click the .dtSmartRule to install it, noting you’ll need to target the Evernote group specifically.

Clean Evernote Imports.dtSmartRule.zip (1.3 KB)

However, I suggest running this on a duplicate with some groups and some loose files too before running it on the actual Evernote group. It should be safe since it’s looking for formatted notes with exactly one link, but it’s always best to test first. It works here as expected.


Sorry for the delay @pete31. They were imported using Import --> Notes from Evernote. The kind seems to be consistently Formatted Note. As such, the Document Display --> Source menu item is greyed out. Trivial example screenshot attached (I’m too new to add two screenshots!).

Maybe I’m missing something, but it seems the Smart Rule does not check whether the text contains only of one link without any other text. If that’s the case it’s not safe to use it.

1 Like
on performSmartRule(theRecords)
	tell application id "DNtp"
		repeat with theRecord in theRecords
			if (count paragraphs) of (plain text of theRecord as string) = 1 then
				set currentLocation to (parent 1 of theRecord)
				repeat with deadRecord in ((children of currentLocation) whose (type of it) is not formatted note)
					set name of deadRecord to (name of theRecord as string)
					move record deadRecord to parent 1 of currentLocation
					move record currentLocation to trash group of (database of theRecord)
				end repeat
			end if
		end repeat
	end tell
end performSmartRule

Gentlemen, this is absolutely splendid. Thank you so much. This is exactly what I was looking for and it will save me considerable effort.

@pete31 was right to highlight the potential risk, as occasionally there is a note which has a comment in addition to the attachment. Mr @BLUEFROG’s update helps avoid this. My only amendment was to change the paragraph count to 2 because it appears Evernote always includes a blank line before the link paragraph. (I’m sure this precise syntax can be checked for programmatically but outliers will be very rare.)

My sincere thanks for your assistance and for giving up some of your Sunday to do so.

1 Like

No problem.

My only amendment was to change the paragraph count to 2 because it appears Evernote always includes a blank line before the link paragraph. (I’m sure this precise syntax can be checked for programmatically but outliers will be very rare.)

I haven’t used Evernote in 5+ years so it’s possible I have older formatted files. Regardless, glad it’s working for you.

In practice, the line count is mysterious: sometimes it appears to be 1 but is actually 3, etc. Possibly carriage returns only? Starting conservatively with 1 and then validating those outliers is the order of the day and monumentally faster than the manual alternative.

I wonder if I might impose upon you both for one additional bit of guidance? As I attempt to arrow key through the items in a list, focus keeps switched to the body of the note rather than the list (so subsequent down arrows move the cursor through the note, rather than down the list). Is there some sort of vi-style command vs editor mode I am accidentally invoking? Otherwise it’s a lot of mouse clicking to flip through lots of notes.

Is this when selecting the formatted notes?

Yes sir

I’m also an Evernote refugee and encountered the note group with attachments (1 or more)
Why is it necessary to take any action?
I can work with these note groups

One issue I have is the tag assignment
I’m thinking tags should be assigned at the group level, not at the child level.
I’m planning to resolve this with an applescript

If I had groups containing of only an attachment and an “empty” note with only a link to that attachment I would also delete everything but the attachment, e.g. because they show up in search results and Smart Groups without adding any value.

What’s the point in keeping these?

1 Like

Feel free to keep the groups if you wish. There’s certainly no harm in having them present. :slight_smile:

1 Like

Now I’m really mystified… arrow keying through the list works fine on my MacBook (hurrah!), but automatically changes focus to the body of the selected note on my iMac (boo!). So I imagine it is a setting in DT that I have accidentally tinkered with? Thank you again for your patient assistance.

Are you showing the view/edit pane on both machines?

I’m not sure what you mean by view/edit pane, here’s what is switched on for both. On the iMac, some of the notes consistently switch into edit mode, and some don’t. I’m sorry, I’m sure this is a super basic function of my ignorance.