Recntly, I got a requirement to update all the content item, basically replacing all spaces with _ (under score).
Here is simple script to do that.
cd '/sitecore/content/Home/Test'
Get-ChildItem -Recurse . | Where-Object { $_.Name -match " " } | ForEach-Object {
$originalName = $_.Name
$newName = $originalName -Replace " ", "_"
Write-Host "Renaming item from " -nonewline;
Write-Host $originalName -f Yellow -nonewline;
Write-Host " to " -nonewline;
Write-Host $newName -f Green;
$_.Editing.BeginEdit()
$_.Name = $newName;
$_.Editing.EndEdit()
}
We can extend this script to update/assoicate the image url for the catalog items and so It's taht much easy.
Thank you for this blog..
ReplyDelete