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

Find and alter confluence pages that not contains ...? - Command Line Interface

Matthias Born May 5, 2012

Hi!

I'm looking for the command to alter pages in a space that not contains the excerpt macro.

I'd like to add an empty or default excerpt.

I'm not shure if it is possible in a single command. Do i have to get a list of that pages before/as input for the storePage action?

And how to say: not contains excerpt.

Danke!

Matze

1 answer

0 votes
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.
May 6, 2012

There are a couple of approaches:

  1. A script to getPageSource to a file, read the file to search for {excerpt} and if not found, update the file to include the empty {excerpt}. Then storePage with the modified file. Do this for each page in the space. I have recently used this approach a site migration and will publish a sample groovy script in the next few days.
  2. If the data to be added is always at the start or end of the current page and you can query the Confluence database, then it is easier - see How to automate adding text to Confluence pages

Matthias Born May 6, 2012

Thank u Bob for the quick answer.

Now i see the way to getPageSource, modify and storePage.
To find pages already have excerpt will be easy. I'll try it tomorrow.
But what's with the rest, these without?
Have i overseen a way to negate the find result?
Do you mean i have to use sql to get these results? Or will the search parameter (confluence search syntax) do it for me?

Thank u!

Matze

Matthias Born May 6, 2012

Very difficult to say: NOT ;-)

"NOT excerpt" without any further search criteria...
But I think that will work (it does in confluence search): "type:page NOT excerpt"
I'll try it with your suggestions and the --search param.
TU!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events