Action

Delete Blank Drafts

Posted by agiletortoise, Last update over 2 years ago

Find all blank drafts and move them to the trash.

Steps

  • script

    // fint blank drafts and move them to trash
    const re = /^.{0}$/;
    let drafts = Draft.query("/^.{0}$/", "all");	
    
    let p = new Prompt();
    p.title = "Delete Blank Drafts";
    p.message = `${drafts.length} blank draft(s) found.
    
    Move blank drafts to the trash?`;
    p.addButton("Move to Trash");
    
    if (p.show()) {
    	for (let d of drafts) {
    		d.isTrashed = true;
    		d.update();
    	}
    	alert("Blank drafts moved to trash");
    }

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.