Renaming an Invalid Filename in NTFS

Recently, I loaned my flash disk to one of my friends, who had Mac OS. He copied a file on it, whose name included a backslash (\).

The flash disk is NTFS formatted. Windows does not allow such filenames, and neither opens the file, nor deletes it, nor lets me delete the file.

There are naive approaches to this problem, like:

  • Formatting the flash disk;
  • Giving it back to my friend and asking to rename it;
  • Loading into some live Linux and renaming it.

However, I'm looking for something more clever, like a program that can do the trick under Windows.

PS: There's a tool called NTFSWalker which can browse the MFT records of the NTFS, but is unable to make any changes to them.


All Win32 APIs use the backslash as a directory separator. There is a slight chance that the POSIX subsystem accepts it as part of the file name, so you could try mv from Services for Unix.


I wouldn't say using Linux to fix is "naive", if Unix was what broke it in the first place.


I've found that 7zip can often deal with strange files when Windows fails (useful for paths that are too long to delete normally) - give that at try.


You can use CHKDSK /F from DOS prompt to fix the errors, and then RD /S <DIR> where <DIR> is the directory you want to delete. Be careful as this will delete the directory and all its sub-directories.