I have a list with about 15,000 items and I need to empty it by permanently deleting everything in the list. I have other items in the recycle bin that I don't want to disturb. Here's the script I'm running:
$url = "https://sharepoint.company.com/sites/mysite/"
$web = get-spweb $url
$list = $web.Lists["DropOffArchive"]
$listItems = $list.Items
$listItemsTotal = $listItems.Count
for ($x = $listItemsTotal-1; $x -ge 0; $x--) {
Write-Host("$x DELETED: " + $listItems[$x].name)
$listItems[$x].Recycle()
}
It appears this is working, but the problem is that it's taking roughly 45 seconds per item. At this rate it will take 3-4 days to fully empty the list. Doing some searching I've found that I can disable the recycle bin on the site, delete the items, they will be permanently deleted, and then turn on the recycle bin. That sounds like it will be much faster, but it will also purge everything currently in the recycle bin.
Are there any better options I'm missing?