I made this file, so why won’t Windows delete it?
Here is a bit of Windows weirdness, with an even weirder solution.
I made a file – to be exact, I expanded a ZIP archive, using standard commands – no ‘special’ utilities. Then when I try to delete it, Windows gets the sulks saying that it can not delete it as “The source file name is longer than supported”. Huh? How did it get on the disk if it is not supported?
So I do some searching expecting to find an easy work-around or command. Instead there are lots of people with the same problem (as far back as Vista) with no solution. I finally managed to delete it, but in a very off-the-wall kind of way by using Robocopy, which is explained below.
The trick is to create an empty folder and then tell Robocopy to mirror that onto the folder containing the bad file. Robocopy will then do exactly as you asked by deleting the file to make the folder the same as the empty folder. The end result is that both folders will be the same – empty!
robocopy /MIR c:\empty c:\delete-everthing-in-this-folder
Caution: Robocopy will do exactly as you ask, without confirmation. So take care and double check because if you get it wrong, you will have a really bad day.