Our assets library keeps growing in size and we need to figure out a way of finding all unused assets , then archive / delete them.
Has anyone solved this in aem 5.6?
Tested in AEM 5.6 with SP2.
You can use the OOTB functionality.
It's necessary to select (from damadmin) the asset that you want to check and select -> tools -> references. In this way you can see if the image is used and in which pages.
The screen below:
Not an Answer
Adding Good reference articles.
If you need to further filter the search, like Find Assets Referenced By Image Components, please refer to article below:-
If page specific,
Please have a look at older forum post covering this same topic.
//You can use http://wemcode.wemblog.com/get_asset_reference_in_page to write your script. First find all Asset using either xpath query (With nodeType as dam:Asset) or iterate through all nodes under /content/dam and then find reference using above code and if reference count is zero then remove that node (Be careful, that non reference node does not mean you will not use it in future). After deleting all asset don't forget to run datastore Garbage collection. Also make sure that you remove all those asset from publish instance as well (Deactivation of those node should do that).
One more reference article:- http://stackoverflow.com/questions/35187627/how-to-find-unused-images-from-cq-dam
// How to find unused images from CQ DAM
I hope this will help you.