Is there a way to determine how many documents or what the file size is for all of the documents that are in the trash in confluence? For an individual space or the entire instance?
I have been doing a lot of cleanup of attachments recently and I know when a document is deleted - it doesn't actually get removed off the server until the trash is purged. I am trying to see if there is a way to determine how much space the trash is taking up so I can decide if I want to purge or not.
Thanks.
This is a query I wrote up a while ago to get the file paths of attachments. I edited it to just pull back the deleted files. The first column would be the file paths for all your deleted files. You could probably use that to get the disk space for all your deleted attachments. Below are the MSSQL and MySQL versions. If you are on PostgreSQL you might need to edit the syntax a bit.
MSSQL
select '/ver003' + '/' + cast(right(SPACEID,3) % 250 as varchar(10)) + '/' + cast(left(right(SPACEID,6),3) % 250 as varchar(10)) + '/' + cast(SPACEID as varchar(10)) + '/' + cast(right(PAGEID,3) % 250 as varchar(10)) + '/' + cast(left(right(PAGEID,6),3) % 250 as varchar(10)) + '/' + cast(PAGEID as varchar(10)) + '/' + case when PREVVER is null then cast(CONTENTID as varchar(10)) else cast(PREVVER as varchar(10)) end + '/' + cast([VERSION] as varchar(10)) as FILEPATH, * from [dbo].[CONTENT] where CONTENTTYPE = 'ATTACHMENT' and CONTENT_STATUS = 'deleted'
MySQL
select replace(concat('/ver003' , '/' , cast(right(SPACEID,3) % 250 as char(10)) , '/' , cast(left(right(SPACEID,6),3) % 250 as char(10)) , '/' , cast(SPACEID as char(10)) , '/' , cast(right(PAGEID,3) % 250 as char(10)) , '/' , cast(left(right(PAGEID,6),3) % 250 as char(10)) , '/' , cast(PAGEID as char(10)) , '/' , case when PREVVER is null then cast(CONTENTID as char(10)) else cast(PREVVER as char(10)) end , '/' , cast(`VERSION` as char(10))), ' ', '') as FILEPATH, CONTENT.* from CONTENT where CONTENTTYPE = 'ATTACHMENT' and CONTENT_STATUS = 'deleted'
PostgreSQL
select '/ver003' || '/' || cast(right(SPACEID,3) % 250 as varchar(10)) || '/' || cast(left(right(SPACEID,6),3) % 250 as varchar(10)) || '/' || cast(SPACEID as varchar(10)) || '/' || cast(right(PAGEID,3) % 250 as varchar(10)) || '/' || cast(left(right(PAGEID,6),3) % 250 as varchar(10)) || '/' || cast(PAGEID as varchar(10)) || '/' || case when PREVVER is null then cast(CONTENTID as varchar(10)) else cast(PREVVER as varchar(10)) end || '/' || cast(VERSION as varchar(10)) as FILEPATH, * from CONTENT where CONTENTTYPE = 'ATTACHMENT' and CONTENT_STATUS = 'deleted'
Thanks , can it use for postgresql use? I try , but it failed.
Would it be possible to give suggestion about it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Anderson Hsu I'm personally an MSSQL guy, so I don't do PostgreSQL much. However, I've edited the above query and tried to replace it with PostgreSQL syntax. Let me know if that works for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Perfect - exactly what I was looking for!
Thank you!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad it helped.
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.