I've got a bunch of folders that upon trying to browse into them, say "<directory> refers to a location that is unavailable"
. In Process Monitor, I see that the actual error code is NAME_NOT_FOUND
— but they are present.
chkdsk
finds no errors in the filesystem.- Neither are they junctions or symbolic links (checked by installing the Link Shell Extension)
I've noticed that the names have a common trait:
- they all have a dot at the end
- in the past, I experienced the same with file/directories with broken names like in the picture:
What's happening here and how do I fix this?
How to delete a file ending in a dot in Windows 7? offers ways to delete it, but that's not acceptable 'cuz I need the contents.
- Unlike
del
suggested in that question,rename "<directory>" "<smth else>"
produces the same"File not found"
. - Neither
\\?\<path>
works (same error).
Best Answer
Windows API "preprocesses" paths before passing them to the kernel. The documentation on this is sketchy: instead, MSDN lists just the net limitations. In particular:
The Unicode I/O APIs that lift the
MAX_PATH
limitation seem to skip that preprocessing as well.So, there are two ways of fixing:
Use a program that uses the Unicode I/O API under the hood. Options include:
mv <bogus_name> <new_name>
Scripting.FileSystemObject
Use the 8.3 name to access the file/dir:
Using the "native path" --
\\?\<full path>
-- doesn't help here because for somecmd
builtins -- at least,dir
andrename
-- these paths are still subject for the preprocessing:(note the missing end dot in the output).