Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Managing attachments in confluence

Jayesh Baviskar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 29, 2018

Hi, 

I am looking to delete multiple attachments on a confluence page. The page was initially created using a copy of an exisiting page. In this process, the attachments from the previous page were carried over to the new page. Im now looking at a list of about 200 attachments. Based on this, Im looking for an effective approach to identify and delete the attachments that are not linked to the front-end of the page (only to looking to identify the attachments that are not in use on the page and to delete these).

 

Could anybody suggest a way to identify the documents that are currently in use/linked on the page vs the attachments that are not in use on the page (one's that are simply piled on to the page located on the back-end). And, is there a way for me to get an indication of the not-in-use attachments in the 'Attachments' window of the page? Please advise.

 

Thank you.

1 answer

1 accepted

1 vote
Answer accepted
Grigory Salnikov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 29, 2018

Hi, @Jayesh Baviskar!

I think I may have the answer.

1. You need to view the "Storage Format":

storage format.jpg

2. Find (or even grep) the word "filename=" and there will be the attachments which is used on the page. The number of occurrences equals the number of 'active' attachments.

I tested it in my environment and it works.

Hope this helps.

Jayesh Baviskar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 29, 2018

Hi @Grigory Salnikov

Thanks a ton. This information is super helpful for me.

 

To confirm again; Is it correct to understand that if i view the storage format, extract all results associated with the word "filename=", I would be looking at a list of all the active attachments that are currently linked on the page? This is really good information.

 

However, I'm also in a fix now. I have a set of 70 pages that require cleaning up of dead attachments. Based on what we discussed, I will need to extract results for each page, retain the resulting attachments on the confluence page, and delete the dead one's (those that don't reflect as part of "filename="). Could you recommend an alternate way to approach this? Some way that would be less time consuming considering the count of 70 target pages... (I'll follow what you suggested in case we don't have an alternate approach for this)

 

A big thank you again for the prompt response.

Grigory Salnikov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 29, 2018

Hi!

Yes, I've tested the behaviour, and it seems ok - the result equals all the 'active' attachments on the page. You can verify it in your environment (I think it's better to).

To reduce the amount of time to be spent on this task I can recommend you the following regular expression:

filename="([^"]|\n)*"

You can either use Notepad++:

regex.jpg

Or using Linux terminal:

egrep -o 'filename="([^"]|\n)*"' <file_with_saved_text_from_storage_view>

to extract filenames only you can add:

egrep -o 'filename="([^"]|\n)*"' <file_with_saved_text_from_storage_view> | cut -f2 -d'"'

Hope this helps.

Grigory Salnikov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 29, 2018

I'm not sure whether it's possible to automate the process even more.

As an alternative way, I can also recommend you this:

Use a WebDAV Client to Work with Pages

I haven't used it myself, though, and can't share any practical advice. 

It's a powerful tool for sure :)

... and worth taking a look.

Grigory Salnikov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 30, 2018

Hi, @Jayesh Baviskar!

How is your task? Have you managed to accomplish it?

Jayesh Baviskar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 30, 2018

Hi @Grigory Salnikov,

I tested suggestion provided by you and it worked for me.

Thank you very much.

Grigory Salnikov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 30, 2018

Hello, @Jayesh Baviskar!

Glad it worked! You're always welcome!

Have a nice day :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events