PostgreSQL Query for Downloading Attachments from Confluence Edited

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. 

0 comments

Comment

Log in or Sign up to comment
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Friday in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

251 views 11 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you