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

How do I delete all confluence spaces?

Srinivas Patruni April 23, 2014

we need to host separate Confluence for one of our teams and so I am planning to take a snapshot of existing confluence db and remove the existing spaces except one required space. So I wanted to remove nearly 100 spaces. Can I remove all spaces in one shot instead of manually removing spaces?

3 answers

1 accepted

2 votes
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
April 23, 2014

Confluence Command Line Interface has removeSpace action which would make it faster and easier for you. You can use this in conjunction with one of the run actions like runFromList.

Srinivas Patruni April 23, 2014

Hi Bob, Will the below action work or do I have to use only with runFromList?

confluence --action runFromSpaceList --common "--action removeSpace --space @space@"

It got SocketTimeoutException when I executed the above command.

Remote error: ; nested exception is:

java.net.SocketTimeoutException: Read timed out

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
April 23, 2014

That should work, but, you said you wanted to delete all but 1 space and that will delete them all. How quickly did you get the timeout? There is a connectionTimeout parameter you can use to increase the timeout, but, I wouldn't have expect you would need that. Can you complete getSpaceList? If so, can you delete the first space on the list without a timeout?

Srinivas Patruni April 23, 2014

It is ok to delete all spaces so I tested with the command. I observed SocketTimeOut exception while deleting every space..

c:\Srinivas\atlassian-cli-3.8.0>confluence --action runFromSpaceList --common "--action removeSpace --space @space@"

Run: --action removeSpace --space Space1

Remote error: ; nested exception is: java.net.SocketTimeoutException: Read timed out

Client error: 1 actions failed

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
April 23, 2014

Ok, perhaps the space is very large and taking too long to complete. So, set a much higher timeout on the remove space action. --connectionTimeout 0 should go forever.

Srinivas Patruni April 25, 2014

I have one question. Can we delete all personal spaces also using CLI tool?

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
April 25, 2014

Yes, runFromSpaceList has an option to include personal spaces. It is off by default. Use --personal to include them in the list.

Srinivas Patruni April 25, 2014

Thank you, Bob..

Aram Ghanimian October 23, 2018

Does this only apply to the cloud instance of confluence or does it include self-hosted?

1 vote
Maren
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 18, 2019

Hi there,

Maren here from Atlassian. It is possible to delete all spaces at once from Confluence Cloud by "resetting" your cloud site, which removes all data from your site and returns settings to their default states. This will affect site data but not user management. 

I hope this helps, and please let us know if you have any further questions.

Best wishes,

Maren

0 votes
Srinivas Patruni April 23, 2014

Hi Atlassians, Any comments please?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events