How to move and rename Items from Source to Destination path in Sitecore using Sitecore PowerShell

Here is the simple script for this:

# database name

$db = “master:”

# source path

$sourcePath = “/sitecore/content/Generic Content/Generic Pages/Basic Generic Item”

# destination path – task was to move the generic pages from generic location to country based locations

$destinationPath = “/sitecore/content/USA/Generic Content/Generic Pages/Basic Generic Item”

$itemsList = Get-ChildItem -recurse -Path ($db + $sourcePath) | Where { $_.TemplateName -eq “Generic Pages” }

$itemsList | ForEach-Object {

# task was to append parent name to the new item

$newName = $_.Name + “-” + $_.Parent.Name


Move-Item -Path $_.ProviderPath -Destination ($db + $destinationPath + “/” +                    $newName)

Write-Host “Moved Item: ” $newName  ” to path: ” ($db + $destinationPath)


Write-Host “Could not move Item: ” $newName




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s