Hacker News new | past | comments | ask | show | jobs | submit login

I knew of NUL, CON, COM#, PRN and LPT# restrictions but never heard of AUX... today I learned two more!

"The following reserved device names cannot be used as the name of a file: CON, PRN, AUX, CLOCK$, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. In addition, any combinations of these with extensions are not allowed."

Restrictions on the File Mask and File Name Properties

https://msdn.microsoft.com/en-us/library/aa578688.aspx




I only learned about these when I was trying to scrape information about airports and save each in their own folder named after their IATA code. I learned about NUL, PRN and CON because of Nulato Airport, Pristina International Airport and Concord Municipal Airport.

Such a weird bug, I didn't know why I was getting a FileNotFoundError from trying to create a new file. Everything online will tell you the directory you're placing it in doesn't exist (it did of course), and no hint that you're trying to use a magic name.


They did it wrong then. IFF you have to map stuff to files they should all be located under /dev/ and not confuse the system if someone happens to use those strings for their own file names in their own places.


Those special files date back to MS-DOS 1.0, which did not have directories. There's some explanation in the blog post below.

https://blogs.msdn.microsoft.com/oldnewthing/20031022-00/?p=...


Agree but these came from DOS days, and were just always brought along for compatibility. I think it could be argued that there's such a thing as too much attention to compatibility...

Edit: MOST of the no-no file names come from DOS, not this $MFT one which is NTFS related so must have come later!


>> I think it could be argued that there's such a thing as too much attention to compatibility...

I'm convinced that most problems people face are rooted in the conflict between short and long term goals.


Well they really come from CP/M and PIP which sort of inherited from DEC OS/8 (certainly they're in the 1973 manual)


I didn't know about CLOCK$





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: