I have more than 50,000 images in pub/media of products.

But there are so many unused images so I want to remove all images which are not associated with any product.

For magento 1.9.x this can be a Reference link but i want the same php script for magento 2.1.


You can use the Hackathon EAV cleaner module for this. After installation you can use the command eav:media:remove-unused

You can find it on Github: https://github.com/magento-hackathon/EAVCleaner/tree/magento2

  • let me try it, will let you know. – Ronak Chauhan Dec 19 '16 at 11:53
  • It's working for me, Thank you so much :) – Ronak Chauhan Dec 19 '16 at 12:05
  • By the way, i've forked the repo so it is now possible to use composer installation: github.com/Vendic/EAVCleaner. The old repo seems to be inactive. – Tjitse Mar 1 '19 at 12:06
  • I've tried to install this. Composer doesn't find it and copying it directly doesn't work for me. Can you point me to or provide some simple instructions please? – PedroKTFC May 29 '19 at 21:59
  • Try composer require hackathon/magento2-eavcleaner – Tjitse May 30 '19 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.