Download all the attachments by space in Confluence Data Center

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Currently, a user or admin can download attachments from a page, or Download from the Attachment view, including downloading all attachments on a page.

Solution

Environment

Confluence Data Center

Known Issue

CONFSERVER-39428 - Download All Attachments from Space

Workaround

Confluence Data Center doesn't have a feature to download all attachments from a space.

However, you can download all attachments from a page.

(Auto-migrated image: description temporarily unavailable)

Using Script and Confluence Rest API

The aim of the below Shell script is to download all the attachments placed in a specific space;

Download Attachments

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 #!/bin/bash # Define variables BASE_URL="" USERNAME="" PASSWORD="" SPACE_KEY="" # Create a downloads folder if it doesn't exist mkdir -p $SPACE_KEY/downloads # Step 1: Get content IDs for type 'page' from Confluence API echo "Fetching page IDs..." page_ids=$(curl -s -u "$USERNAME:$PASSWORD" "$BASE_URL/rest/api/content?spaceKey=$SPACE_KEY" | jq -r '.results[] | select(.type=="page") | .id') # Step 2: Iterate over each page ID and get the attachment download URLs echo "Fetching attachment download links for each page..." for page_id in $page_ids; do echo "Processing Page ID: $page_id" # Fetch attachments for the page attachments=$(curl -s -u "$USERNAME:$PASSWORD" "$BASE_URL/rest/api/content/$page_id/child/attachment") # Extract the download URLs using jq download_links=$(echo "$attachments" | jq -r '.results[] | ._links.download') # Check if there are any download links and process them if [ -n "$download_links" ]; then echo "Downloading attachments for Page ID $page_id..." # Iterate through each download link and use wget to download the file for link in $download_links; do # Construct the full download URL by appending to the BASE_URL full_url="$BASE_URL$link" # Remove the query string section from the URL (anything after the `?`) base_url=$(echo "$full_url" | sed 's/\?.*//') # Use wget to download the file with basic authentication and additional flags echo "Downloading $base_url..." wget --user="$USERNAME" --password="$PASSWORD" --auth-no-challenge --trust-server-names --max-redirect=20 --header="User-Agent: Mozilla/5.0" "$base_url" -P ./$SPACE_KEY/downloads/ done else echo "No attachments found for Page ID $page_id." fi done echo "Download completed."

ℹ️ The variables in the script should be filled out accordingly before executing it.

ℹ️ After the execution of the script the directory will be created with the space key and it will contain the downloaded attachments.

Attachments view

  1. From the page, click on the

    (Auto-migrated image: description temporarily unavailable)

    and select Attachments.

  2. Scroll to the bottom of the attachment list and click Download All.

⚠️ Please note that browser extensions aren't supported by Atlassian.

Also, Chrome has a extension to download all attachments. Batch Link Download

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.