Forum Moderators: open

Message Too Old, No Replies

Trouble with filename

Windows won't let me name a file: con.html

         

innocbystr

8:31 am on Jan 31, 2006 (gmt 0)

10+ Year Member



Was trying to save a new file in a sub-directory of my website. Tried naming it con.html

First it said that the file already exists, do you want to replace it? I typed yes. Then it said:

Error saving.... Probably the file is write-protected or locked by another application.

I have no file by that name in my entire website. Of course I named the file something else. Just thought that this was very odd. Any ideas anyone?

Thanks,
Blair

bill

9:00 am on Jan 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



con is a reserved filename in any MS OS.

Naming a file [msdn.microsoft.com]:

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
.

innocbystr

3:24 pm on Jan 31, 2006 (gmt 0)

10+ Year Member



Thanks Bill. I was hoping that it was an OS thing and not something that a hacker left behind. Must go all the way back to early DOS.

Have a good one,
Blair

kaled

10:22 pm on Jan 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, con == console.

Because there was no way directly to test for the existence of a directory in a batch file, people used to test for the existence of the file c:\somedir\con since this was deemed to exist in any directory.

I wanted to use nul as a black hole in XP a couple of weeks ago and it wouldn't work. I guess we have the legacy of not being able to use these reserved file names without the benefit of their functionality in some cases.

Kaled.