How do I delete an asset with module or plugin
I'm not sure how well it'd go with 50,000 Assets, but you should just be able to call Craft::$app-&gt;elements-&gt;deleteElement($asset) for each one, or Craft::$app-&gt;elements-&gt;deleteElementById($asset-&gt;id), as seen in the Elements Class Reference.