Skip to content

Instantly share code, notes, and snippets.

@rsisco
Last active January 11, 2021 23:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsisco/6deeb3209ec9a396c859ca249a9ab5fa to your computer and use it in GitHub Desktop.
Save rsisco/6deeb3209ec9a396c859ca249a9ab5fa to your computer and use it in GitHub Desktop.
Magento 2 - Identify gallery image files missing from filesystem
mysql -u <user> -p <db> -h <host> -e "SELECT distinct case when value like '/%' then concat('.',value) else value end FROM catalog_product_entity_media_gallery" | awk '{print $1}' | xargs ls | grep "cannot access"
@molotovbliss
Copy link

BTW, just a note so I don't forget or someone else uses the snippet, it should be run under pub/media/catalog/product/ missing one folder.

@rsisco
Copy link
Author

rsisco commented Dec 18, 2019

BTW, just a note so I don't forget or someone else uses the snippet, it should be run under pub/media/catalog/product/ missing one folder.

Thanks; I've updated the comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment