List Page and Space Details that Contain an Attachment via the Attachments Name

Still need help?

The Atlassian Community is here for you.

Ask the community

Occasionally, the indexing task will report some attachments that failed to be indexed correctly. If you wish to list the page and space-related information for these problematic attachments, (of which you only know their title from the logs) please query your database with the following SQL statement:

select s.spacekey, s.spacename, a.title, a.pageid, a.attachmentid, '(confluence-home)/attachments/' + a.pageid + '/' + a.attachmentid + '/' + a.attversion as filepath
from attachments a
join content c
    on a.pageid = c.contentid
join spaces s
    on c.spaceid = s.spaceid
where a.title like '<Name of Attachment>'

Please substitute the attachment name in the above query depending upon your requirement.
The filepath column will list all attachments in the directory structure format similar to the way that they are stored in Confluence, such as <Confluence-Home>/attachments/pageid/attachmentid/attachmentversion

Related Linux Commands

file <Filename>

If you wish to check the filetype for attachments in your <Confluence-Home>/atachments/ folder, run the above Linux command.
For example:

file ../data/attachments/32775/98305/1

The result is:

../data/attachments/32775/98305/1: PNG image data, 1200 x 1000, 8-bit/color RGB, non-interlaced

open <Filename>

This command will open files from a shell. By default, opens each file using the default application for that file.

open ../data/attachments/32775/98305/1 -a /Applications/

The result is:
The file is opened in Preview.

Last modified on Feb 23, 2016

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.