Corrupt Directory?

B

Brian Kelly

I have a directory entry that appears to have somehow become corrupted and
cannot be deleted or other wise affected.

It was created by CheckDsk at some point. The only thing I can do to it is
rename it (which I have, to "foo"). Anything else causes an error.

--Trying to delete in Windows Explorer returns: "Cannot delete foo: The
directory name is invalid."
--Trying to delete from a command prompt returns: "The directory name is
invalid."
--Trying to access the directory in Windows Explorer returns: "D:\foo is
not accessible. The directory name is invalid."
--Trying to change to the directory via command prompt (CD) returns: "The
directory name is invalid."

I have run another check disk, to no avail.

Any thoughts?

Thanks,
Brian
 
R

R. C. White

Hi, Brian.

When ChkDsk finds a "lost chain" that looks like a directory, it gives the
lost chain the name FOUND.001; later such lost chains are named FOUND.002,
etc. If you recognize the filenames in FOUND.001, you may be able to rename
the directory and then Move it back into the parent directory where it
belongs. In most cases, though, the information is incomplete or wrong - in
other words, useless. It may be salvageable, but at such a high cost of
time and effort that it should be considered a total loss. Since ChkDsk has
already give it its best shot, further iterations of ChkDsk are not likely
to do any good.

From the Command prompt, type: dir foo*.* /x. The /x switch should produce
an extra column in the directory listing, showing the Short File Name (SFN),
also known as the 8.3 filename, before the LFN. Even short filenames are
considered LFNs if they contain any characters (including spaces) that are
not allowed in a valid MS-DOS filename. Then Remove the SFN.

Remember that Del deletes FILES; rd (or rmdir) removes DIRECTORIES. So the
proper command is: rd foo

If that doesn't work, then isolate this directory in a parent directory that
contains nothing else. Either Move foo or, if you can't to that, then move
everything except foo from that directory to a temporary directory. Then
remove foo's parent directory completely with: rd <parent of foo> /s. The
/s switch for rd removes the named directory and everything within it:
subdirectories, files and all - including foo.

In the "DOS" window, you can see a mini-Help file showing the switches
available for each command by typing the command followed by /?. So, type
dir /? or rd /? to see the switches and what each one does.

If that doesn't work for you, please post back with details of what you
tried and what results you saw.

RC
 
B

Brian Kelly

Thanks for the suggestions. I have actually gone down these roads, but was
trying to keep the problem description simple in the hopes of a quick answer
without having to post a novel.

Anyway, here are the results to the various other approaches

--I realize the directory created by checkdsk is worthless; I am just trying
to kill it.

--I placed "foo" in D:\test and tried deleting D:\test from Windows
Explorer--received same error as previously: Cannot delete foo. The
directory name is invalid.

--I tried deleting "D:\test" using a command prompt (rmdir /s test)--after
answering the prompt (Are you sure?), received the error: test\foo - The
directory name is invalid.

--Attempted to get the short file name with dir /x. There is none listed.
I suppose the short file name could be a space or tab or something and I
would not know, of course, but I do not think that you can put a non-visible
character in a SFN.

As further information, this is a Win2K Pro box with NTFS file system.

Thanks for your continued ideas,
Brian
 
R

R. C. White

Hi, Brian.
--I tried deleting "D:\test" using a command prompt (rmdir /s test)--after
answering the prompt (Are you sure?), received the error: test\foo - The
directory name is invalid.

This works fine for me. (Don't you just love messages like that?)
--Attempted to get the short file name with dir /x. There is none listed.

Yeah. Me, too. But, of course, my "foo" was just created from my typing,
so I already know there were no strange characters in it. If the name had
been created by some other process, who knows what might have appeared.
I suppose the short file name could be a space or tab or something and I
would not know, of course, but I do not think that you can put a
non-visible
character in a SFN.

Spaces don't show up. Characters (visible or not) that are not allowed in
an 8.3 filename are automatically converted to ASCII.

I've run out of ideas down that rd <SFN> road, I'm afraid. Let's back up a
couple of steps.

What was the directory name before you changed it? FOUND.001? Or something
similar - or quite different? HOW did you rename it to "foo": Command
prompt? Windows Explorer? You said you could rename it to "foo", but
"Anything else causes an error." What error? All these symptoms seem very
strange to me. Are you sure you don't have a virus or other malware?

I upgraded from Win2K to WinXP on the day it came out, but they should
behave the same in this regard. I studied FAT in depth back when hard
drives were new and undependable, and rebuilt my share of FATs and
directories, byte by byte, using Norton's DiskEdit, but haven't had to learn
NTFS that well.

RC
 
B

Brian Kelly

The original name was "FOUND.001" or something similar (might have been
..002).

By "You said you could rename it to "foo", but "Anything else causes an
error."" I mean that I can rename it to anything I want without a problem,
but trying to delete it with RD (or DEL, which, with /S, should work if I
put it in D:\Test and type DEL /s D:\Test) gives an error.

I guess I need to hunt down some sort of low-level NTFS utility that can go
figure out what is wrong with the directory and fix it up.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top