9

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.

Dennis Williamson
  • 106,229
  • 19
  • 167
  • 187
Sadeq Dousti
  • 661
  • 2
  • 9
  • 17
  • 2
    You'll find [How to force Windows XP to rename a file with a special character?](http://superuser.com/questions/31587/how-to-force-windows-xp-to-rename-a-file-with-a-special-character) a useful read as well - the only real answer there was to use Linux. – DMA57361 Nov 24 '10 at 18:33
  • Try Check Disk. (Right click on disk icon → Properties → Tools → under Error-checking, click Check Now → check Automatically fix file system errors.) This was one of the suggestions in the linked question above, but was never tried. – Bavi_H Nov 25 '10 at 04:32
  • @Bavi_H: Sorry, Check Disk did not work either. – Sadeq Dousti Nov 25 '10 at 09:21

4 Answers4

5

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.

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
  • I tried `mv` before. It didn't work. – Sadeq Dousti Nov 24 '10 at 19:36
  • About "naive": I meant some solution that comes to mind at the first place. – Sadeq Dousti Nov 24 '10 at 19:38
  • @Sadeq: Which `mv` are you talking about? – u1686_grawity Nov 24 '10 at 20:04
  • @grawity: I used two variants: [GNUWin32](http://gnuwin32.sourceforge.net/) and [UnxUtils](http://unxutils.sourceforge.net/). – Sadeq Dousti Nov 24 '10 at 23:00
  • 2
    @Sadeq: Both of them are plain Win32 programs. I explicitly mentioned Services for Unix for a reason — its programs run in a separate ["POSIX" subsystem](http://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem), with different rules than those of Win32. – u1686_grawity Nov 25 '10 at 12:58
  • @grawity: Sorry, I did not notice "Services for Unix" in the first place. Unfortunately, it did not work either :( – Sadeq Dousti Nov 27 '10 at 08:55
  • 1
    The POSIX subsystem also uses [`NtOpenFile`](http://msdn.microsoft.com/en-us/library/bb432381.aspx) to open files, and `NtOpenFile` treats the path as a whole, not as a series of components (there's a flag to use "POSIX" semantics, but that's only for case sensitivity) -- so it follows the same rules. – user541686 Jan 22 '12 at 08:24
3

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.

Dentrasi
  • 11,155
  • 4
  • 27
  • 28
2

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.

Alois Mahdal
  • 2,254
  • 4
  • 21
  • 37
julian
  • 21
  • 1
-1

I opened the folder with inaccessible character files in 7zip file manager. There, I renamed it and BINGO, it got renamed. Thus I was able to access the file.

7zip is a freeware file compression utility, better than RAR.

slhck
  • 223,558
  • 70
  • 607
  • 592
Arun
  • 1