How to delete multiple tiddlers by matching on title

831 views
Skip to first unread message

Sean Boisen

unread,
Feb 7, 2018, 1:41:31 PM2/7/18
to TiddlyWiki
I've been using TiddlyWiki for weekly planning for some time, so I've got lots of tiddlers with titles like "week of 2014/01/06" that are no longer relevant. It takes multiple clicks to delete them one by one, which is a pain for dozens of obsolete tiddlers. I don't have tags on them. How can I
  1. Create a list of tiddlers whose titles match some string (simple equality, or even better, regex)
  2. Delete them as a batch

?

Diego Mesa

unread,
Feb 7, 2018, 1:57:34 PM2/7/18
to TiddlyWiki
Hey Sean,

To be extra safe, you can use something like this:

''Going to delete the following tiddlers:''
<br/>
<$list filter="[!is[system]regexp[^Formatting List]]" variable="tidToDelete">

* <<tidToDelete>> <br/>

</$list>

!! ''If you are sure''

Copy/
paste the filter above into this button:

<$button>
Delete these tiddlers!
<$list filter="PLACE_FILTER_HERE" variable="tidToDelete">
<$action-deletetiddler $tiddler=<<tidToDelete>>/>
</
$list>
</$button>

This makes use of the regexp operator:

https://tiddlywiki.com/#regexp%20Operator

 
If you copy/paste the code I placed above into a new tiddler on tiddlywiki.com you can see that it will delete all Tiddlers whose title start (thats the ^ character means) with "Formatting List". It prints those titles out to make sure you are going to catch only the right ones. If you're happy, you can copy/paste the filter into the button where Ive indicated and then press it to delete them.

For your use case, you can change the filter to be something like:

"[!is[system]regexp[^week of]]"

But make sure before you place this in the button filter!

Diego

Diego Mesa

unread,
Feb 7, 2018, 3:18:09 PM2/7/18
to TiddlyWiki
Note!

This is, in essence, a more complicated (but safer!) way to accomplish waht is essentially already built in to TW. To do it without typing any code:

  1.  Go to Advanced search --> Filter
  2. Type in your filter
  3. Verify the list of links that pops up. When happy:
  4. Click the trash icon. A popup will appear asking if you are sure with a button. If you are sure, press that button.

In the code I pasted above, you have to manually copy/paste/type something to trigger the deletion (similar to how github works in deleting repositorys if you are familiar).


I hate accidently losing data!

@TiddlyTweeter

unread,
Feb 7, 2018, 4:39:43 PM2/7/18
to TiddlyWiki
Batch deleters exist.

TiddlyWiki itself in Advanced Search does that too. Use the FILTER option and you can delete anything.

J.

registrierungs genervter

unread,
Jan 20, 2019, 7:15:23 AM1/20/19
to TiddlyWiki
My Hero.

Am Mittwoch, 7. Februar 2018 21:18:09 UTC+1 schrieb Diego Mesa:
Note!

(...) essentially already built in to TW. To do it (...)
Reply all
Reply to author
Forward
0 new messages