6

I have some files with 'impossible filenames'. I'm not talking about special characters or anyting, but really impossible ones. (filesystem NTFS)

One file is called images\receipt.jpg (yes, this is just the filename, not a path+filename)

another is called ..\..\data\

another is called "\n" (a single newline, escaped so you can see it here)

They are created by Ubuntu, when I saved/moved files with my Windows-mind (I don't know how the third one is created). I don't have any Linux or live-CD anymore.

I've tried every suggestion in previously asked questions, but maybe something new is possible since 2 years ago.

CHKDSK /F /X doesn't work

Using the 8.3 filename doesn't work (there are no 8.3 filenames for these files)

REN doesn't work

RD /S doesn't work

7-Zip doesn't work

I can't even defrag the disk because the defragmenter trips when it encounters these files during analyzing.

I tried programming my own rename function, but without low-level system calls (kernel32 defrag api comes to mind, but is too dangerous to just try), it keeps ordering path elements by '\' characters, so it can't find "receipt.jpg" in folder ~~/"images/", etc.

Is there any program that I can use to rename/delete them? Perhaps something like PCTools (20yo DOS program) that can 'edit' the sectors like a Hex editor?

3 Answers3

3

By default, every file and directory under an NTFS filesystem has two names by which it can be accessed: the long filename and the short filename. Short filenames follow the 8.3 naming convention which you may be able to use to delete these files by using the Command Prompt. For example:

C:\>del C:\example\IMAGES~1.JPG

You can learn the short name for a file by issuing this command dir /X (that's a capital X.)

Since short filenames are an optional feature of NTFS it's possible that these files don't have short names. In which case, you might be able to do it by using the extended length path form of the files' paths. You do this by prepending \\?\ to the full path of the file, enclosing it with quotes:

C:\>del "\\?\C:\Example\images\receipt.jpg"

If all else fails, go and download another Linux Live CD and delete them from there. There are smaller distros available if an Ubuntu download is too large.

0

A simple technique fixed files that began with a space character.
(I can't test it on your bad-named files.)
Have you not tried these:

ren images?receipt.jpg images-receipt.jpg
    or, shorter:      ren i*.jpg images-receipt.jpg
ren ??????data? data
ren ? lf

Failing these, you could use HxD to edit the partition itself. Find the directories and type over the filenames. Search the drive for "" and "..", and replace where it seems safe. (Filling the slack space on the drive with zeros might make it easier.)

Apparently programs can create files with illegal names. Maybe a program could rename these files.

A876
  • 240
0

Try FreeCommander. (via this forum thread: (Solved) - help renaming after ALT+255)

Also the ALT key trick for entering otherwise invalid filename characters might work:

  • Hold down Alt while entering the ASCII code number of the character to enter that character.
  • For example, hold down Alt and type 092 on the numpad to insert \; 013 to insert \n
  • You may need to use four digit numbers like 0092 and 0013...

Personally, I'd just make a quick LiveLinux usb and fix it from there. Is there a reason you can't use Linux?

Leftium
  • 9,335