Biggest DAM Assets

This script generates a CSV List of all DAM Assets sorted by file size

import java.text.DecimalFormat;

hm = MgnlContext.getWebContext().getJCRSession('dam')

query = "/jcr:root//element(*, mgnl:asset) order by jcr:content/@size descending";
result = QueryUtil.search("dam", query, "xpath", "mgnl:asset");

println "path,size in mb"
  
result.each { c ->
    if (c.hasNode('jcr:content')) {
        println c.getPath() + "," + new DecimalFormat("##.##").format((PropertyUtil.getLong(c.getNode('jcr:content'), 'size')/1024/1024).doubleValue())+"mb";
    }
}