Moving and Copying Items
This page covers how to move and copy Sitecore items using SPE, including transfers within databases and between databases.
Moving Items
Use Move-Item to transfer items from one location to another. The item retains its ID and all version history.
Basic Move Operations
Example: Move an item to a new parent.
$sourcePath = "master:\content\home\sample item"
$destinationPath = "master:\content\home\moved"
Move-Item -Path $sourcePath -Destination $destinationPathExample: Move and rename in one operation.
# If "new-name" doesn't exist, item is moved and renamed
$oldPath = "master:\content\home\old-name"
$newPath = "master:\content\home\new-name"
Move-Item -Path $oldPath -Destination $newPathMoving via Pipeline
Example: Get an item and move it using the pipeline.
Moving with Children
By default, Move-Item moves the item and all its descendants.
Example: Move an entire content tree.
Copying Items
Use Copy-Item to duplicate items. By default, the copy receives a new ID.
Basic Copy Operations
Example: Copy an item to a new location and change display name.
Example: Copy and return the new item.
Recursive Copying
Example: Copy an entire tree maintaining structure.
Copying Between Databases
Copy items between databases (e.g., from master to web) using transfer options.
Example: Transfer item with same ID to another database.
Using -TransferOptions 0 maintains the same ID. This is useful for publishing workflows but can cause conflicts if the item already exists in the target database.
Transfer Options
The -TransferOptions parameter controls how items are copied between databases:
0
Keep original ID
1
Create new ID (default behavior)
2
Allow default values
4
Allow standard values
Example: Copy with new ID (default behavior).
Bulk Operations
Pattern: Move Multiple Items
Pattern: Copy Items Based on Criteria
Pattern: Reorganize Content Structure
Pattern: Copy with Progress Reporting
Maintaining Structure
Pattern: Copy Tree Maintaining Hierarchy
Dynamic Parameters
DestinationItem
Move-Item, Copy-Item
Parent item to receive moved/copied item
-DestinationItem $parent
FailSilently
Move-Item, Copy-Item
Suppress unauthorized access errors
-FailSilently
TransferOptions
Copy-Item
Controls ID handling (0=keep, 1=new)
-TransferOptions 0
PassThru
Copy-Item
Returns the new item
-PassThru
Recurse
Copy-Item
Includes all descendants
-Recurse
Performance Considerations
Batch operations - Group multiple moves/copies together
Use BulkUpdateContext - When copying many items with field updates
Progress reporting - Provide feedback for long-running operations
Avoid unnecessary recursion - Only use
-Recursewhen neededTest first - Use
-WhatIfparameter if available, or test in development
Common Pitfalls
Pitfall: Moving to Non-Existent Path
Pitfall: Copying Without PassThru
See Also
Retrieving Items - Find items to move or copy
Creating and Removing Items - Item lifecycle management
Best Practices - Performance optimization
Appendix - Common Commands - Full cmdlet reference
References
Last updated