5

I am trying to delete a file named "Kanno, Yoko - Where Does This Ocean Go?.mp3" from my hard drive in Windows 7 Ultimate x64 and it keeps telling me that it cannot because the file name is too long or invalid (due to the "?" in it). I cannot rename it, cannot delete it, cannot do so either with Explorer or with CMD. I also cannot delete the folder containing it either with Explorer or with CMD.

Does anyone have an answer or suggestion to try? I have no idea how such a name ever got created in the first place (software to rename files according to their title, but still, it should not have been saved with an invalid name like that). Regardless, how can I now get rid of it?

Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311

4 Answers4

4

Microsoft has an Article about hard to delete files.

Most of the time for me, prepending the path with \\?\ does exactly what I want. So you could try del "\\?\c:\path\Kanno, Yoko - Where Does This Ocean Go?.mp3"

There is also \\.\ and I don't know what the exact difference to \\?\ is.

Both prefixes seem to disable some checks and/or make del use lower level APIs than the usual Win32 API.

Josef
  • 1,354
2

Resolved: I plugged the hard drive into an external casing and connected it via USB to my Android tablet as a USB drive. Using my Android File Browser, I navigated to that file and deleted it. Android will not let you name files with "?" in them either, nor could I play that file while it had an "?" still in it, but Android let me rename/copy/move/delete it, so problem solved, just not with Win7. FYI, I could play the mp3 file just fine once I removed the "?" from the name.

1

I just did this and I'm only answering to help others on Windows 7-10. I literally opened the location of the file in Winrar and changed its name, only because the windows file manager could not change the name due to it having an invalid character. After changing its name I deleted the file. EZPZ also, good music choice I love Ghost in the Shell!

WubGub
  • 11
0

Try this from the command line:

del Kanno*.mp3

Or perhaps try to find the short name of the file and delete that. I think dir /x will list the short names, but my recollection is hazy.

The only thing I can imagine that might produce that is an invalid character encoding. When the system encounters text that has been encoded incorrectly it can display as "?".

Windows is more careful about not allowing wildcards in filenames that some other systems. Many years ago I remember a colleague making a file named * on a UNIX system. That incident did not end with smiles.