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.
Hi, @Jayesh Baviskar!
I think I may have the answer.
1. You need to view the "Storage Format":
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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++:
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, @Jayesh Baviskar!
How is your task? Have you managed to accomplish it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.