Invalid File Names in Windows

Today when I want to copy a project from my Linux machine to Windows, I get a very unusual error.

cp: cannot create regular file ‘Share/bookrepo/target/guestbook-java-1.0-SNAPSHOT/js/aux.js’: Operation not permitted
cp: cannot create regular file ‘Share/bookrepo/src/main/webapp/js/aux.js’: Operation not permitted

It says that we can't copy a file named aux.js to the destination. However the file has exactly the same permission as others, so why it is handled separately? After googling for a while I get the astonishing answer: AUX, with all possible extensions, are invalid file names in Windows! WAT??

According to the MSDN documentation, the following names are reserved and could not be used to name a file.

  • CON
  • PRN
  • AUX
  • NUL
  • COM[1-9]
  • LPT[1-9]

Since file names are case insensitive in Windows, aux.js accidentally fails into the range, and thus cause the error. I would say it is a terrible design because no one knows that before he/she encounters the problem!

Here is an article talking about the history behind those invalid files names. It is hard to believe that the idea can be traced back to 1973 CM/P OS, even before the DOS. All the new things build on it, including DOS, Windows NT, and .NET, are suffering the same problem just for COMPATIBILITY!