Find orphaned images/media in media library

Brandon White asked on April 4, 2018 21:25

Hello, I am looking for solutions to keep our media library clean of unused files. We have a media library with ~20gb of data and I'm sure there are many files that are not deleted when they are not needed anymore. We have 300 active users so policing this to try to make sure media is removed is difficult. Has anyone else dealt with this issue and found a solution within Kentico or elsewhere? I know I might be able to use a web crawler tool like Link Sleuth to crawl the site and find orphaned files, but wondering if there are other options that can be automated in some way?


Correct Answer

Michal Samuhel answered on April 5, 2018 14:51

Hey, Brandon.

From Kentico perspective, there is no such tool, since it would be too performance heavy (even our notice on missing database file representation is killing azure storage).

Automation for this would also be a bit complicated. Media file usage will be spread in web parts, document fields, widgets and even transformations or templates. This would require you to crawl over CMS_Document and other respective tables and look for file GUID, or name... Since this data is in XML mostly you would need either custom SQL script to search through larger portion of DB, or C# parser for XML to find out whether file is being mentioned somewhere.

It is doable, but it would take some effort and it will certainly be quite resource consuming.

1 votesVote for this answer Unmark Correct answer

Recent Answers

Brandon White answered on April 5, 2018 20:35

Ok, thank you for the information.

0 votesVote for this answer Mark as a Correct answer

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