Got over 200 items in various folders in one location that would like to copy to a new location while retaining the same folder structure. Each item has more than one version and would like to retain that as well.

Task 1: Copying multiple folders containing multiple items to a new location.

Task two: Updating the part of the Items' path with the new location. Example

Location A/Folder 1/subfolder 4/item_100

update it to

Location B/Folder 1/subfolder 4/item_1000

New contributor
AIM is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

You have 2 ways - if you can connect up Sitecore Rocks, that has an option to multi-select items and move them around in Visual Studio and rename etc...

The second option would be to use Sitecore PowerShell Extensions (SPE) to script that out. This example will give you a good starting place:

$rootOfitemsToMove = Get-Item “/sitecore/content/Location A/subfolder 4”;
$destinationItemPath = “/sitecore/content/Location B/subfolder 4”;

$templateNameToMatch = “My Template”;

Write-Host “Moving items from: ” $rootOfitemsToMove.Paths.FullPath ” to: ” $destinationItem.Paths.FullPath ” …”;

Get-ChildItem | Where-Object { $_.TemplateName -match $templateNameToMatch } | ForEach-Object {
    $name = $_.Name
        $newName = "$($name)0"  # Add some logic here to rename the folder
        $newPath = "$($destinationItemPath)/$($newName)"

        Move-Item -Path $_.ItemPath -Destination $newPath;
        Write-Host “Item moved to: $($newPath)“;
        Write-Host “Couldn’t move Item: ” $name;

Write-Host “Moving items complete.”;

You would need to work out the logic of how the folders are renamed. Moving a parent folder should also move the child items with it.

  • You make it so simple. Thank you. – AIM Dec 7 at 13:31
  • @ Richard, one more question. Can you apply this logic to pages as well? but still updating path of the components associated. Example copying page 1 and 2 from location A to Location B. Then updating the components of page 1 and 2 with the new location B as part of their path. – AIM Dec 7 at 13:43
  • The presentation is a field on the item, so that will copy with the item. If the datasource paths need updating, you can also do that with SPE - I would suggest opening a new question for that – Richard Seal Dec 7 at 13:49
  • Thank you again. I will do that right away. – AIM Dec 7 at 13:51

Your Answer

AIM is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.