remove item versions
This PS script will iterate over the items and remove versions greater than the count specified.
$versionCount = 5
$items = Get-ChildItem -Path "/sitecore/content/path/to/folder" -Recurse
foreach($item in $items)
{
if($item.Versions.Count -gt $versionCount)
{
Write-Output "---------------------------"
$item.DisplayName
$item.Versions.Count
Remove-ItemVersion -Path $item.FullPath -Language "en-*" -Recurse -MaxRecentVersions $versionCount -Verbose
Write-Output "---------------------------"
}
}
note
In my experience this takes a lot longer than it should - consider revisiting for a more performant approach.