Auto-Delete or Bulk-Delete Blank Notes

(Sorry if this exists and I missed it)

Ability to auto-delete all blank notes (they do pile up). Maybe whenever a blank note becomes #2 in the queue?

If that’s too invasive, maybe at least a function to bulk delete all blank notes (i.e. saving lots of swiping)?

1 Like

You can search for them by using regular expressions. A search /^.{0}$/ will find all blank drafts, you than switch to the “All” tab, select-all (tap and hold on “Select” on iOS for options) > Operations > Trash.

If it’s something you may want to do often, an action could be written to delete all blank drafts with a script something like:

// find blank drafts
let drafts = Draft.query("/^.{0}$/", "all", []);
// loop over and delete them
for(let d of drafts) {
  d.isTrashed = true;
  d.update();
}

Curious, however, how you are ending up with a lot of blank drafts. Drafts tried to avoid creating them, and they should only end up being saved if they once had text and you removed it - and those are not automatically deleted because they might have other data associated with them (versions/action histories, etc.) that should not be auto-deleted.

For anyone who happens to have the Thoughtasylum - Management action group, the TAD-Blank Drafts to Trash action does this.

It utilises the TA_trashEmptyDrafts() draft function. That function also returns the number of drafts moved to trash if you wanted to build it into your own clean up action and summarise the results.

2 Likes

Yes, I frequently cut (not copy) all text out of a note. Should probably use share sheet or actions instead, but sometimes this is faster for my workflow.

You might using a “Copy” action, with it set to trash the draft after copying. It would be quicker than selecting text and using “Cut”, which can be a bit fiddly (at least on iOS), and not leave behind the blanks.

I cut rather than copy because I intentionally want to blank out the item (and if Drafts doesn’t clean up after me, at least I won’t have to spend time in triage later).

I think most Mac users instinctively use“copy” when they want to leave the original alone. So copy-with-delete special-action is very counterintuitive behavior that may engrain if you’re a Drafts super-user, but I’m not. So for me that would be way, way more confusing than cut-then-later-nuke-blanks.

Not complaining, just offering my user experience in case it’s helpful.

1 Like

This is exactly what I was just thinking. :point_up:t2:

I seem to generate vast numbers of blank drafts (including I guess by cutting and pasting per above, but also blank ones ones with tags, which seem to get stored when I hit an iOS widget to create a tagged note and then get diverted). A setting that stopped these from piling up in the first place would be very helpful.