Skip to content

Instantly share code, notes, and snippets.

@e0ipso
Created December 31, 2013 17:50
Show Gist options
  • Save e0ipso/8200170 to your computer and use it in GitHub Desktop.
Save e0ipso/8200170 to your computer and use it in GitHub Desktop.
-- Select all media galleries and find all images in there that follow the path structure: public://images/%/%/%/%
SELECT n.nid, fmi.field_media_items_fid, file.uri
FROM
node n
INNER JOIN
field_data_field_media_items fmi ON fmi.entity_id = n.nid
INNER JOIN
file_managed file ON file.fid = fmi.field_media_items_fid
WHERE
n.type = 'media_gallery'
AND
file.uri LIKE 'public://images/%/%/%/%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment