How to delete file that has invalid name?

How to delete file that has invalid name?

  • Possible Duplicate: http://superuser.com/questions/90227/files-with-illegal-filenames I've accidentally created -?.tgz file on my NTFS hdd (working under linux). And I'm just curious is it possible to delete it under Windows 7 using standard tools? Things I've tried: 1) move *.tgz die.tgz gave me same error "The file name you specified is not valid or too long" 2) File had no short windows name, so I was not able to delete it using short name

  • Answer:

    Have you tried putting double quotes around the file name? You can also try typing "del " then keep pressing Tab when you are in the same directory as the file - this will loop through the files in that folder.

Viller at Super User Visit the source

Was this solution helpful to you?

Other answers

It's only a suggestion because I can't try now. In the past I have gotten rid of files with invalid names (mainly files with a terminating space) with this command: del "\\?\c:\full_path_to_file\-?.tgz"

Steve

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.