PostgreSQL Query for Downloading Attachments from Confluence

Ethan McDonald
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 12, 2017

I recently had to download all the .swf file from our confluence site.
The solution online sent me to a page that showed the attachments and then I had to click someting to download it.
This gave me a direct link to every file I needed.

Below is the PostgreSQL query created to assist me in this task.

SELECT title, version, pageid, 
'​h​t​t​p​s​:​/​/your-server-here/​d​o​w​n​l​o​a​d​/​a​t​t​a​c​h​m​e​n​t​s/' || pageid || '/' || title || '?version=' || version as URL
FROM content 
WHERE contenttype = 'ATTACHMENT' 
AND title like '%.swf' 
AND prevver IS NULL 
AND spaceid IS NOT NULL 
ORDER BY lastmoddate DESC

From here you could do all kinds of things like generate a CURL command and pull every file down.
For me I just emailed the URL column to myself and clicked each link. 

1 answer

0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 26, 2024

Hi @Ethan McDonald ,

what is your question?

Fabio

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events