Report of all unlinked media library objects for periodic housekeeping?

Jason S asked on May 21, 2020 20:40

Does anyone have good processes or methods to share for finding media library content that is not linked or used anywhere in a portal engine site in v12?

I've periodically had CMS editors ask if there is a way to easily find all unused items in media libraries so they can safely be deleted as a means of good housekeeping. As far as I know, Kentico lacks any built in method for finding this data easily, so I'm curious if anyone has good ideas to share on this.

Thanks,

Jason

Recent Answers


Brenden Kehren answered on May 21, 2020 20:57

Yes Kentico "lacks" this but there's not good way to find this quickly. You'd have to search through ALL pages, page types, all page type fields, possibly attachments, web parts, web part layouts, templates, layouts, etc. Seems like this could be a recipe for a disastrous report depending on how many times you run it and how many content items you have.

There are virtually endless possibilities here. For example, you can store an unliminited number of files in the media library. You'd have to do a search for every file in the media library in the content tree. In the content tree, you'd search every page and every pages fields for that file's path. After you're done searching the page types, you'll have to search the document's content (in the event they used editable text or editable images, then you'll have to search the objects like web parts, web part layouts, templates, and layouts to see if the URL exists in those.

Pretty ugly scenario but it could be done, just be very careful on when and how often you run the report.

3 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.