Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article presents step by step instructions on how to delete spaces in bulk using the Confluence CLI app.

Instructions

Use For this task, use the runFromSpaceList  along with removeSpace actions as explained. Use the removeSpace action to delete spaces from Confluence in bulk.

Option 1: 

  1. Execute the following command if you have the space keys list . In the below example, clispace1, clispace2, clispace3 are the space key. 

    Code Block
    themeMidnight
    --action runFromSpaceList --input "--action removeSpace --space clispace1" --input "--action removeSpace --space clispace2" --input "--action removeSpace --space clispace3"

     

Option 2: 

If you are not aware of the space keys, then follow the below steps. 

  1. Create a CSV file with the space keys that need to be removed. Run the following command using the getSpaceList action. 

    Code Block
    themeMidnight
    --action getSpaceList --file "spacelist.csv"



  2. Run the following CLI action along with the runFromCsv action to delete spaces. Ensure that the spacelist.csv file has only space keys with the column name 'space'.

    Code Block
    themeMidnight
    --action runFromCsv --file "spacelist.csv" --common "--action removeSpace" --continue


    Sample CSV file:


    The parameters used in the above actions are:

    • --space value refers to the space : Space key.

    • --removeSpace: Remove a space by key.
    • --remove value refers to comma-separated list of space permissionsinput: Line of input used in place of file data for run actions. One or more input parameters are used as lines instead of using the file parameter. In some cases requiring a file parameter, it may be necessary to use a special value of + to indicate to use the input parameters instead.
    • --Common: Common parameter string added to all run actions.
    • --continue value processing : Continue processing even after errors are encountered for run actions. Also used for some action to ignore certain errors like not found errors on remove actions.
    • --file value refers to path Path to file based content.


Info
  • Test the action in a test environment before implementing in production.