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 Join to comment
Community showcase
Bridget Sauer
Published Jan 29, 2018 in Confluence

Showcase: How LinkedIn does Content Lifecycle Management (12 Steps)

LinkedIn, the world's largest business network has an exceptionally large Confluence instance. In their case, large means millions of pages and thousands of spaces. In this Showcase, we're focusing i...

835 views 0 12
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot