Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.


We have several files on a Windows server that show up in directory listings but can't be accessed. I can take ownership of the files, and the ACL shows that Everyone has read/write/execute access; but I can't open the files. chkdsk finds no problems on the volume.

The server is 64-bit Win 2008 R2 Standard SP1.

We had a BSOD recently on this server, and the files were modified shortly before the crash. The crash wasn't in anything filesystem-related, but I'm thinking it corrupted something in kernel memory and that corrupted the filesystem.

Here is some of what I'm seeing when trying to access file "com2.log":

D:\Logs\Application>dir com2*
Volume in drive D is Data
Volume Serial Number is 84D5-FD84

Directory of D:\Logs\Application

09/07/2011  06:57 PM           169,025 com2.log
       1 File(s)        169,025 bytes
       0 Dir(s)  39,320,612,864 bytes free

D:\Logs\Application>dir com2.log

 Directory of \\.

File Not Found

D:\Logs\Application>dir com2.*

Directory of \\.

File Not Found

D:\Logs\Application>cacls com2.log
The filename, directory name, or volume label syntax is incorrect.

D:\Logs\Application>more com2.log
Cannot access file \\.\com2

D:\Logs\Application>more com2*
Cannot access file D:\Logs\Application\com2.log

(cacls doesn't show the ACL, but I can see it in Windows Explorer.)

It seems like it might be a problem with the extension. dir com2* finds it but dir com2.* does not.

The file shows up as com2.log in Windows explorer, but when I double-click it, I get this error in Notepad referring to a .txt file extension:

Cannot find the \\.\com2.txt file.
Do you want to create a new file?

Has anyone seen anything like this before? Any suggestions for troubleshooting?

share|improve this question
1  
I've seen some flaky stuff like this before that a reboot resolved. Have you rebooted the server and tried again? –  joeqwerty Sep 13 '11 at 23:07

2 Answers 2

up vote 8 down vote accepted

COM2 is a reserved keyword, quite literally for the hardware port COM2 and I'm not sure how that file got there in the first place, since Windows won't let you create a file called COM2.log. Try it now, you'll get an error message. For fun, also try creating LPT1.txt.

According to Naming Files, Paths, and Namespaces, the following are all reserved names and should not be used as file names.

  • Do not use the following reserved device names for the name of a file:

    CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended.

You might try renaming the file either in explorer or using ren com2.log somethingelse.log to see if you can manipulate the file then, however I have a feeling that won't work for the same reason you shouldn't be able to create the file in the first place.

Failing that, if you follow How to Remove Files with Reserved Names in Windows you should be able to remove the file with the following command. Using the same "fully qualified" path, I imagine you'll also be able to rename the file by using REN instead of DEL.

DEL \.\C:\SomeDirectory\com2.log

share|improve this answer
4  
Worst case, boot of a linux livecd that supports NTFS. You should be able to delete from there. –  Zoredache Sep 13 '11 at 23:43
    
Yes, that didn't occur to me, but should also be quite effective. –  Ben Pilbrow Sep 13 '11 at 23:45
1  
@Ben: I totally forgot about reserved file names. That takes me back to the DOS days (LOADHIGH, DEVICE=, VSAFE, etc). Thanks for the stroll down memory lane. –  joeqwerty Sep 14 '11 at 0:13
    
@Joeqwerty, safe mode will do nothing; you just need to use the escaped full path name to bypass the reserved device name. –  psusi Sep 14 '11 at 0:16
2  
The problem filenames came from cygwin - we were using it to grep through some log files and save the results. I wasn't able to move the files using "move", but Cygwin "mv" did the job. Thanks for the fully-qualified path technique, I'll remember that too. –  Richard Beier Sep 14 '11 at 0:26

You might try moving the file: move com2* com2.log.new or something of the sort. The filename itself might be messed up.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.