Force delete of files in Windows 7

Easy to end up with files that Windows 7 won’t let you delete even as admin. Properties -> whatever is useless.

Found this on some random response on microsoft forum, but wasn’t quite right, so here’s what worked (where h:\del is the dir with stuff to delete in it)

takeown /f h:\del /r   (or maybe it needs ” ” around the path? Something not right…)

icacls “h:\del\*”  /grant %USERNAME%:F /T /C

rd /S h:\del

This still doesn’t get rid of all files but out of 20,000 that I couldn’t delete only 2 were left. Note I had to repeat this a couple of times, not sure why, but each time more got deleted.

 

Tuesday, July 26th, 2011 Frustration, Windows 7 system