A folder that refused to be deleted, invalid file handle

So I'm using Windows 8 Pro x64 and I have a folder that refused to be deleted every time I tried. It's a backup of my friend's flash disk. I can delete every file inside but one folder. Here is the situation:

1. It's name is "con" and it's directory is "C:\Users\Van Geaux\Documents\asfas\asfasf\con"
2. Whenever I tried to delete it, whether using shift+del or just del or delete button on the ribbon, the confirmation dialogue come up but then nothing happened. The deletion process don't even show up.
3. I tried using elevated command prompt and run <del "C:\Users\Van Geaux\Documents\asfas\asfasf\con"> but it says that "The filename, directory name, or volume label syntax is incorrect"
4. I googled a bit and found an app called Unlocker, but it didn't help me at all
5. Whenever I tried to change its name, it says "Invalid file handle"
6. It's already 2 months since I first struggle with this problem, and I don' want to use system restore. Actually, I don't have any restore point to that date.
7. I haven't tried safe mode. But looking at the problem at hands, I don't think it will help.

So that's it. I'm already in desperate mode here. I suppose I can hide the folder so it doesn't trouble my eyes, but it's not a solution right? By any means, please help me. And sorry for my bad English.
 
Question Info

Last updated July 19, 2018 Views 31,012 Applies to:
Answer

PROBLEM SOLVED

I realize this is old, but I had this problem and didn't see a good solution already posted, so...

Background

The issue is that CON is a reserved name in Windows, so it doesn't like folders with this name. (Similar things likely happen with other reserved names like PRN.) The problem arises when you have this folder created by other operating systems where it isn't a reserved word.

Windows and Windows applications don't handle this folder well at all, so in my case, I wanted to just delete it.

Solution

You can remove this using the command line, but will want to reference the location differently than you normally would (using UNC).

If the folder is C:\documents\con, then this command entered on the command line will remove it:

rd \\.\c:\documents\con /S /Q

rd is the command line tool to remove the directory.

\\. refers to the current computer.

\c:\documents\con is the path of the offending folder entry.

/S is a switch that tells rd to remove all subdirectories and files (like the old DELTREE command).

/Q is a switch that tells rd to this removal silently (you won't be prompted for removing the contents).

Change the \c:\documents path to whatever the location is for your CON folder.

Of course, this deletes the entire folder and its contents. It may be possible to rename or copy the folder to another name. I didn't have much luck with the rename, but I also didn't spend too much time on it.

Note that although you can use Windows Explorer to browse to the location \\., Explorer doesn't let you delete the folder. You need to use the command line to remove the CON folder.

150 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Answer
Good afternoon,

Your post was very helpful to me. I was having problems deleting a file named "con. *" And receiving the message "Invalid file handle". Just replace the command you mentioned (rd) with (del) and everything worked fine.

Thank you!
alex felipe - mcp , mcdst

24 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.