Unlock seamless workflows and faster delivery with our latest releases ā€“ get the details

How to Delete All Assets That Aren't Used After Development

2 replies
Last updated: Sep 27, 2021
During development I needed to add a lot of assets that are not necessary any longer. Is there a way to delete all assets that aren't currently used?
Sep 27, 2021, 10:17 AM
Hi
user T
, this snippet should let you do exactly that šŸ™‚ https://github.com/sanity-io/sanity-recipes/blob/master/snippets/deleteUnusedAssets.js
Sep 27, 2021, 10:33 AM
Works like a charm. Thanks!
Sep 27, 2021, 10:34 AM

Sanityā€“ build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?