0

i need to create new script if the image not present in real folder and not in used than delete from cache folder

example

Cach folder image

pub/media/catalog/product/cache/2a584e14ed2061ee0dac7db2e52f28f9/1/_/1_asc-d-404-mn_dollcarrier_minnie_2000.jpg

"pub/media/catalog/product/1/_/1_asc-d-404-mn_dollcarrier_minnie_2000.jpg"

if this image not present in => "pub/media/catalog/product/"

than delete from => "pub/media/catalog/product/cache"

this kind of script i need to create can any one help me how can i archive this

1 Answer 1

0

First of all, you have to take a backup for the media folder and there is a way to delete unused images is using a module. Here is one that you can use. It is not risk-free, so do a backup first. You can use it from Github free.

reference: https://jvmsaas.com/support-en/magento-2-delete-unused-product-images-without-extension

Github : https://github.com/Vendic/EAVCleaner

2
  • can this module delete images from cache folder ?
    – Jay Parmar
    Commented Sep 30, 2021 at 5:01
  • I did not try but you can check that module from the above link and check useful commands there. Commented Sep 30, 2021 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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