You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
after having read this article, I wrote a short script to compare the filenames of the attachments actually used in a page with the filenames of the files actually attached to the page.
I'll make it then cycle through the various spaces to look for the many attcahments that users have been draggin in and then simply forgot there.
I still have to check for those attachments that are no more present in their storage page but maybe linked from some other page, even though I guess this should be a rare case.
As usual for me, it's not perfect/elegant & not finished, but it seems to do what I need.
If it can be of some start/help for anybody, then I'm happy.
def pageManager = ComponentLocator.getComponent(PageManager)
def attachmentManager = ComponentLocator.getComponent(AttachmentManager)
def page = pageManager.getPage('~MySpace', 'Check Attachments')
//Acquisisco contenuto pagina
def body = page.bodyContent.body
//Definisco lista allegati citati nella pagina
//Definisco lista di tutti gli allegati della pagina
//Definisco lista allegati non utilizzati
//Faccio un parse del contenuto pagina
def parsedBody = Jsoup.parse(body)
//Cerco blocco attachment
def attachments = parsedBody.select("ri|attachment")
//Scorro tutti i blocchi attachment trovati
//Cerco allegati alla pagina
//Riordino le liste
log.warn('Allegati alla pagina:')
log.warn('Presenti nella pagina:')
log.warn('Allegati non utilizzati nella pagina:')
Thanks for sharing this script! I will pass this along to the rest of the ScriptRunner for Confluence team. We enjoy seeing how our users are utilizing SR - it is insightful for us. 😃