I have recently had to rescue files from a bad HDD, and am in the middle of cleaning up the mess. Currently I'm using a duplicate cleaner to delete any restored files that have duplicates on my backup. I'm comparing contents, not file names as file names are mostly generated by the rescue program.
Unfortunately, some of the files I need to delete are given file names that contain all sorts of characters like %, @, ; and other stuff that causes issues. My dupechecker gets stuck when trying to delete the files, showing no progress for hours trying to discover items to delete.
So I exported the list of files to delete and turned to Powershell to delete them. It deletes some, but soon fails when it encounters disruptive characters in file names.
My Powershell command:
Get-Content d:\dupelist3.txt | Remove-Item
An excerpt of the file list (added CR to improve readability):
G:\HE12 #2 recovery EaseUS\Recovered data 09-06 09_23_00\1 HE12 2 (F) NTFS\Other lost files---[100%]--[All-files-CRC-OK]--[16-files]-
"G:\HE12 #2 recovery EaseUS\Recovered data 09-06 09_23_00\1 HE12 2 (F) NTFS\Other lost files\FTP_SERVER.LOG;6"
"G:\HE12 #2 recovery EaseUS\Recovered data 09-06 09_23_00\1 HE12 2 (F) NTFS\Other lost files\GOPHER.$5516417292;1"
"G:\HE12 #2 recovery EaseUS\Recovered data 09-06 09_23_00\1 HE12 2 (F) NTFS\Other lost files\GOPHERRC.;1"
G:\HE12 #2 recovery EaseUS\Recovered data 09-06 09_23_00\1 HE12 2 (F) NTFS\Other lost files\listener[1].htm
"G:\HE12 #2 recovery EaseUS\Recovered data 09-06 09_23_00\1 HE12 2 (F) NTFS\Other lost files\TELNET.LOG;1"
The file list was originally a csv file which I handled using Excel to extract only the path and filenames from the export of my dupechecker. Thus some file references were encapsulated in double quotes when exporting the (tab delimited) text file from Excel. I notice how the first item in the list over is represented wrongly in this post, as there should be a backslash after "Other lost files" and before the three following dashes. Guess that illustrates the issue somehow :)
So my question is; how can I delete all the files in my list given the complications at hand? Manual manipulation won't work as there are 100k+ files in the list, and I have multiple lists.
I'm open to using other tools as long as they get the job done...
Best regards,
Steinar