delete/replace the old files jpg and png in webp

delete/replace the old files jpg and png in webp

Hello, I would like to ask if there is a ready-made solution when replacing jpg and png in webp format to delete the old files /jpg and png/, to avoid duplicate files and increasing the inodes of the hosting service!

I currently have over 17,000 products and each one has 3-6 photos, which is over 80,000 photos, now it's 160,000! if we include categories and articles, I have more than 240,000 :)