PostgreSQL Query for Downloading Attachments from Confluence

Ethan McDonald 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. 

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events