Retrieve attachments across Jira and Confluence

Retrieve attachments across Jira and Confluence

As an administrator, you may need to retrieve a comprehensive list of attachments across all Jira issues or Confluence spaces. While both Jira and Confluence support the getAttachmentList action, which typically retrieves attachments for a single issue or space, you can also use this action to collect attachments across the entire product.

Performance considerations

When working with large instances, this operation can take significant time and system resources. To minimize impact:

  • Run the commands during off-peak hours.

  • Split large requests into smaller batches when possible.

  • Increase the Java memory allocation for the ACLI client, if needed.

Retrieve attachments in Confluence

You can retrieve attachments across all Confluence spaces with a single command:

--action getAttachmentList --outputFormat 2 --space @all --file list.csv

This command gathers attachment data for all spaces and writes it to list.csv.

Retrieve attachments in Jira

Retrieving attachments in Jira requires more steps, especially for instances with more than 1,000 issues. Jira's JQL and pagination limitations mean you'll need to break the task into smaller chunks. Depending on your project size and setup, there are two approaches.

Option 1: Use a favorite filter (recommended for large instances)

  1. Create a filter that returns all issues. For example, name it all.

  2. Mark the filter as a Favorite for the user running the command.

  3. Delete or clear the output file (list.csv).

  4. Run the following command:

--action runFromIssueList --filter all --common "--action getAttachmentList --outputFormat 2 --issue @issue@ --file list.csv --append"

Why this works

  • ACLI can only access Favorite filters remotely.

  • Using a filter enables paging across more than 1,000 issues.

Option 2: Split by project (simpler, if each project has fewer than 1,000 issues)

  1. Delete or clear the output file (list.csv).

  2. Run the following command:

--action runFromProjectList --common "--action runFromIssueList --search \"project = @project@\" --common \"--action getAttachmentList --outputFormat 2 --issue @issue@ --file list.csv --append\""

For guidance on quoting, see Tips for quoting rules in the documentation.