🦍 maniedzi's blog

List attachments in Confluence Space

I recently had a need to create a list of all the attachments in a given confluence space. In this particular situation, the data was needed to analyse why the size of one space is 1/3 the size of the whole instance.

This can be done using the Confluence API, but I thought it would be simpler to retrieve this data from the database. Below is the query I created for this purpose:

select page.title page_title, a.title file_name, p.longval "file_size"
from content a, contentproperties p, spaces s, content page
where p.contentid = a.contentid
  and s.spaceid = a.spaceid
  and page.contentid = a.pageid
  and a.contenttype = 'ATTACHMENT'
  and p.propertyname = 'FILESIZE'
  and s.spacekey = 'XXX';

Just change the XXX to the space key, and you're done.


There is an RSS feed for this blog.

#work