19

I just encountered a really weird bug on Windows 8.1.

I can't seem to be able to create a folder named Aux or starting by Aux.. I tried on every disk, but I get the following message every time: Le nom du périphérique spécifié n'est pas valide (The name of the specified device is invalid).

Why is that? Is there a specific/valid reason? Is it specific to my computer?


I discovered this because I programatically created a folder named Aux and I can't delete it anymore. I guess I have to run a script or program to get rid of it. (As it usually happens with such scenario on Windows)

Vadorequest
  • 16,593
  • 24
  • 118
  • 215
  • 3
    `aux`, `prn`, and `con` are reserved for legacy reasons. `prn` refers to the printer, for instance, and `con` refers to the standard keyboard (console). It's a remnant of MS-DOS retained for compatibility reasons, I'd guess. You can still see `con` in use at a command prompt: type `copy con test.txt` in a folder where you have write access, type some text, and hit F6 to commit to disk, and then `type test.txt` to display what you typed on the screen. – Ken White Mar 25 '16 at 18:33
  • @KenWhite Do you have a source? Thanks anyway :) – Vadorequest Mar 25 '16 at 18:34
  • 3
    The source is 30+ years of experience with MS-DOS and Windows development. :-) See the section with the bullet points [here](https://msdn.microsoft.com/en-us/library/aa365247.aspx) – Ken White Mar 25 '16 at 18:35
  • Thanks again! Do you have a solution to delete such folder? It has a file inside which has the same name. Something like `Aux.doe/Aux.doe.txt`. I've tried several things so far, nothing has worked. – Vadorequest Mar 25 '16 at 19:12
  • Btw, if you'd like to add a proper answer, I'd accept it ;) – Vadorequest Mar 25 '16 at 19:13
  • Does this answer your question? [Unable to index file](https://stackoverflow.com/a/48961041/4265352) – axiac Jun 18 '21 at 08:31

2 Answers2

29

aux, prn, and con (among some others) are reserved for legacy reasons. prn refers to the printer, for instance, and con refers to the standard keyboard (console). It's a remnant of MS-DOS retained for compatibility reasons, I'd guess.

You can still see con in use at a command prompt: type copy con test.txt in a folder where you have write access, type some text, and hit F6 to commit to disk, and then type test.txt to display what you typed on the screen.

There's a bunch of information in Naming Files, Paths and Namespaces (Windows) - for the parts that are relevant to your question, see the section with the bullet points, specifically this item:

  • Do not use the following reserved 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. For more information, see Namespaces.

Ken White
  • 123,280
  • 14
  • 225
  • 444
  • 1
    While CMD has poor support for device paths (i.e. paths that start with "\\?\" and "\\.\"), it does support them in a few cases, such as basic file operations. You can create a file/directory with a reserved DOS name (i.e. names with DOS devices or trailing spaces and dots) using a non-normalized device path (i.e. an extended path) that begins with the "\\?\" prefix. The path must be fully qualified, e.g. `mkdir \\?\C:\Temp\aux`. However, I highly recommend against this because the shell and most programs do not support it, plus DOS device names are disallowed by the SMB server in UNC paths. – Eryk Sun Feb 02 '20 at 15:33
0

I'd like to add my experience : If your machine has windows and ubuntu dual boot, delete it from ubuntu filesystem.

Also in Ubuntu, I don't know if it is a problem with git or ubuntu, when i cloned a certain project which had a file named 'aux.c' in it, there was an error saying 'encountered an error while cloning aux.h and aux.c ...'. I used

git clone [project-git-url]

If we only download the .tar file and then extract it, even then an error was encountered.

So, this is a really idiotic bug and I hate MS-DOS btw.(who even uses MS-DOS nowadays?)

  • 2
    This is not an answer but upvoting because is highlights how one OS (Windows) can affect others, and how people who write things that are nothing to do with an OS in particular (like a NPM lib) need to be aware of those glitches introduced decades ago. – Vadorequest Jun 20 '21 at 09:04
  • Yes, totally agreed. Now I understand that Windows is most probably interfering in the extraction / cloning even when using ubuntu? Still can't wrap my head around how though. – shaleenbathla Jun 21 '21 at 13:48