The Bash Script will help you to get all AEM Assets which are not related to a page.
This can be helpfull to delete images you dont need or just for other debugging purposes.
The outcome will be
- unrelatedassets.txt -> Full path of all images as text file
- unrelatedassets.html -> HTML File with a direct link to the asset
https://github.com/hashimkhan786/aem-groovy-scripts/blob/master/findUnusedAssets.groovy
Its a groovy based solution. I compared the outcome to my script, but it gave some assets as "unrelated" even though a relation was present. To make it work you need to install. https://github.com/icfnext/aem-groovy-console
I am a REALLY BAD Coder (but a much better Architect), so please be nice to me. I know that there are much nicer ways to approach this problem, but it works and i had lack of time. :)
If there is anybody out there who wants to make the script nice, be my guest.
I tried this on my mac, so maybe some changes need to be done in order to make it work on Windows etc.
You need to install jq, php and sed
Edit the first lines of the script:
- aemurl="http://localhost:4502" -> Path to your AEM Instance
- aemcontentpath="/content/dam/weretail" -> DAM Root Path
- aemusername="admin" -> Admin User Name
- aempassword="admin"-> Admin Password
Clone the repo, cd into the folder and run
bash AEM_get_unreferenced_images.sh