Skip to main content
using code syntax highlighting, linking the SOURCE of the post
Source Link

You can find orphaned files by running the following MySQL query:

SELECT fm.*

FROM file_managed AS fm

LEFT OUTER JOIN file_usage AS fu ON (fm.fid = fu.fid)

LEFT OUTER JOIN node AS n ON (fu.id = n.nid)

WHERE fu.type = 'node' AND n.nid IS NULL

SELECT fm.*
FROM file_managed AS fm
LEFT OUTER JOIN file_usage AS fu ON (fm.fid = fu.fid)
LEFT OUTER JOIN node AS n ON (fu.id = n.nid)
WHERE fu.type = 'node' AND n.nid IS NULL

This returns all files which have no associated node. I'm not sure if it's safe to delete the returned rows and files, probably also depends on your module setup. Only use at your own risk!

Source: http://drupal.org/node/733258#comment-5582764

You can find orphaned files by running the following MySQL query:

SELECT fm.*

FROM file_managed AS fm

LEFT OUTER JOIN file_usage AS fu ON (fm.fid = fu.fid)

LEFT OUTER JOIN node AS n ON (fu.id = n.nid)

WHERE fu.type = 'node' AND n.nid IS NULL

This returns all files which have no associated node. I'm not sure if it's safe to delete the returned rows and files, probably also depends on your module setup. Only use at your own risk!

You can find orphaned files by running the following MySQL query:

SELECT fm.*
FROM file_managed AS fm
LEFT OUTER JOIN file_usage AS fu ON (fm.fid = fu.fid)
LEFT OUTER JOIN node AS n ON (fu.id = n.nid)
WHERE fu.type = 'node' AND n.nid IS NULL

This returns all files which have no associated node. I'm not sure if it's safe to delete the returned rows and files, probably also depends on your module setup. Only use at your own risk!

Source: http://drupal.org/node/733258#comment-5582764

Post Undeleted by David Carter
Post Deleted by David Carter
Source Link

You can find orphaned files by running the following MySQL query:

SELECT fm.*

FROM file_managed AS fm

LEFT OUTER JOIN file_usage AS fu ON (fm.fid = fu.fid)

LEFT OUTER JOIN node AS n ON (fu.id = n.nid)

WHERE fu.type = 'node' AND n.nid IS NULL

This returns all files which have no associated node. I'm not sure if it's safe to delete the returned rows and files, probably also depends on your module setup. Only use at your own risk!