---
title: "How to copy a page hierarchy to the same space"
canonical: "https://support.appfire.com/space/SUPPORT/89150445/How%20to%20copy%20a%20page%20hierarchy%20to%20the%20same%20space"
format: markdown
---
# Description

Copying a page hierarchy to the same space needs to be done carefully as Confluence doesn't allow duplicate page names in a single space. This is solved by using the **@title@** replacement variable so you can change the names of all the target names using a prefix or similar.

# Example

```shell
confluence --action copyPage --space Examples --title "My example" --descendents --newTitle "PREFIX - @title@" 

Page 'My example' copied to 'PREFIX - My example' in examples.
Page 'My example 1.1' copied to 'PREFIX - My example 1.1' in examples with parent 'PREFIX - My example'.
Page 'My example 1.2' copied to 'PREFIX - My example 1.2' in examples with parent 'PREFIX - My example'.
Page 'My example' with 2 descendents copied to 'PREFIX - My example' in space examples.  Page has id: 341186939.
```