Delete a large list of files
Posted on 2012-03-27
I'm trying to delete bad file archive stubs so they can be restored from backup. I have a 80 meg list of 800,000 files with full local path I need deleted. It works, just need it to be smoother, logging, no errors etc.
Ideally I want to get-content from a txt file then remove-item with -LiteralPath switch as . Obviously avoiding errors escape characters and spaces in directory names as well, and any logging of errors would alos be great though I know this may not be possible.
Originally we have a powershell simple script that looked like this.
get-content "c:\deletelist.txt" | Remove-Item
This works well with a few files that don't have  in file name or spaces or escape keys, but using this command with the -LiteralPath option to sidestep this seems impossible to my feeble mind.
Can anyone suggest a way they would do this? Much appreciation in advance.