Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

export attachments from JIRA_HOME of the project

Neno
Contributor
July 9, 2024

Hi guys, 

I need help, how to download all attachments form the Issues in the project.

I can't install Bulk and to do it manual it's gonna take long time, because there is a lot of issues. 
The attachemnts are stored in a folder structure in Jira_home according to ticket keys. I need to keep the structure with the ticket keys. 

Please any suggestion is welcomed. 

Regards

5 answers

1 accepted

0 votes
Answer accepted
Cömek_ Dr_ Arif July 9, 2024
  1. You can use a filter as the following to find all the issues have attachment/s. 
    • "project = PRJ6 AND issuetype = Bug AND attachmentsCount >=1"
  2. Click on the next/desired issue on the left side (the first one will be selected automatically after the filter is applied)
  3. Click on the 3 dots at the right side of the "Attachments"
  4. Select "Download all" even there is only 1 attachment
    • So, you have the file/s in a zip file with the name of the issue as in "PRJ6-1366_attachments" and keep the structure with the ticket keys.
  5. Repeat the steps 2-4 for all the issues found with the filter.
Cömek_ Dr_ Arif July 9, 2024

Of course always you can try one of the apps in Atlassian Market Place by searching
Attachments Manager .

Neno
Contributor
July 9, 2024

Screenshot 2024-07-09.jpg Is it okay like this, because am getting error, i can't add the filter.

Screenshot 2024-07-09 at 16.40.34.png

Cömek_ Dr_ Arif July 9, 2024 edited

Please do not attempt to add a filter, just implement it and just use the JQL box to write the query directly, do not copy and past.

If you want to get the info and the fields of the issues, you can use "Export issues" button on the top right always.

Neno
Contributor
July 10, 2024 edited


Thanks for the help. Filter created. 

Like • Cömek_ Dr_ Arif likes this
0 votes
Dick
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 9, 2024
USE YOURJIRADBNAME
DECLARE @@MDT nvarchar(255) = 'YOURPROJECTKEY'
SELECT fa.id, concat(p.pkey,'-',ji.issuenum) as 'Issue', st.pname as 'Status', 
concat('/opt/jira-shareddata', '/data/attachments/', p.originalkey, '/', ceiling((ji.issuenum / 10000))* 10000, '/', p.originalkey, '-', ji.issuenum, '/', fa.id) as 'path',
fa.filename, cast(fa.FILESIZE/1024/1024 as decimal(18,2)) as 'Mb'
FROM fileattachment fa 
join jiraissue ji on ji.id = fa.issueid 
join issuestatus st on st.ID = ji.ISSUESTATUS
join project p on p.id = ji.project 
WHERE cast(fa.FILESIZE/1024/1024 as decimal(18,2)) > 0.1 -- Filesize in Mb
--and ji.UPDATED < '2022-12-31 23:59:59'
--and p.pkey in (SELECT p.pkey FROM project p WHERE p.id NOT IN (select entity_id from propertyentry where property_key = 'jira.archiving.projects') ) -- non-archived project
and p.pkey = @@MDT
--and st.pname not in ( 'Done', 'Resolved')
ORDER BY 
p.ID
--fa.FILESIZE desc
--fa.filename
;

 

-------------------

Above is the MS-SQL script I'm using to get the issues containing attachments.
You get the IssueID, Issuekey, Status, Path, Filename and the size in Mb. The lines starting with dashes are optional filters and sortings to get on top of the attachments.

0 votes
Dick
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 9, 2024

Hi Nenad,
For some reason my posted answer is wiped. 
It describes the way how to retrieve filenames and locations on a project basis. I'll post it under this message, in the hope that it won't be deleted as malicious code.

Cömek_ Dr_ Arif July 9, 2024

Hi Dick,

I faced the similar issue and solved it by copying the text from Notepad and then pasting it to this area :)

Like • Dick likes this
0 votes
Dick
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 9, 2024 edited

cleaned up double post, apologies.

0 votes
Dick
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 9, 2024 edited

 

 

cleaned up double post, apologies.

Suggest an answer

Log in or Sign up to answer