How to get a list of all attachments

Description

It is very easy to get a list of attachments for a single space, list of spaces, or all spaces for a site. This describes how to get attachment information even if are using On Demand version of JIRA. Download users could do something similar using an SQL based query on the JIRA database. The CLI provides theĀ getAttachmentListĀ action that produces a csv file with detail attachment information. There are a variety of subsetting options including by page usingĀ search and by attachment information usingĀ regex matching. Using --outputFormat 2 provides the most information.

Example Output

Single Space

--action getAttachmentList --space ACLI --file attachmentList.csv --outputFormat 2 --dateFormat yyyy-MM-dd

All Spaces

--action getAttachmentList --space @all --file attachmentList.csv --outputFormat 2 --dateFormat yyyy-MM-dd

List of Spaces

--action runFromList --list ACLI,BCLI --clearFileBeforeAppend --common "--action getAttachmentList --space @entry@ --file attachmentList.csv --append --outputFormat 2 --dateFormat yyyy-MM-dd"

Run CLI Actions in Confluence add-on

If you have theĀ Run CLI Actions in Confluence, then the following will provide a page listing all the attachments. In this example, we sort by size descending.

{cache:refresh=7d|showRefresh=true|showDate=true}
{csv:macros=true|sortColumn=7|sortDescending=true|columnTypes=S,S,I,S,I,S,I,S,S,S,D,S}
{cli:profile=confluence|panel=false}
--action getAttachmentList --space @all --outputFormat 2 --dateFormat yyyy-MM-dd --quiet 
{cli}
{csv}
{cache}