On my Windows machine, I had a folder with a name of four dots that acted like some kind of rabbit hole - how did that happen?

Win32 doesn't let you create files or folders with names ending in . – all dots are stripped from the end. Trying to create test. makes test appear instead. (This is for compatibility with 8.3 names in old DOS/Win9x era software.)

As a result, whenever you try to access a folder named ...., its name gets reduced to the empty string, and you're back to the folder you were in before.

The NT kernel, however, does allow such names. There are various mechanisms which bypass filename limitations imposed by Win32 APIs – for example, WSL (Windows Subsystem for Linux) doesn't run on top of Win32 and is unaffected by it. There is also the \\?\ bypass method, a deliberate "backdoor" left in for programs which know what they're doing. Even though you cannot create C:\Example\....\, you can create \\?\C:\Example\....\ just fine.

Likewise you can delete such directories with rmdir \\?\C:\path\... from Cmd (I haven't tested with PowerShell yet).

Various file managers, archivers, etc. might use the \\?\ method in order to be able to use longer path names than usual – and by doing so, they're also unaffected by the compatibility code within Win32; they bypass dot stripping, as well as translation of magic filenames like CON or NUL.

So it could be that one of your programs:

  1. always uses \\?\ to access files,
  2. accidentally tried to create a folder named .... – but it's not really possible to know for sure after the fact.

In addition to @grawity's answer, a Win32 program can also do this by calling "native" API directly. If I'm not mistaken, in the present case, that would be NtCreateDirectoryObject. Those calls are fairly well documented nowadays, especially their kernel counterpart (which you cannot call from a Win32 program), in this case, ZwCreateDirectoryObject .

Regarding the "endless depth", an easy way to achieve this is to use links. Create a directory, then inside it, create a junction to it (you can use mklink /j for instance), and you will end up with a very deep structure. Last time I did this was on Windows 2000, there was an end to the recursion though (you couldn't "dig infinitely"). Possibly on newer OS the limit is bigger or removed, also you could create let's say 10 directories each being a child of the previous one, and in the 10th one, create a link back to the first one.


There is an easier way to create the directory. From the command prompt type:

MD ....\

and hit enter, it will create a directory with four dots. This directory is also viewable with explorer.

There is a flaw in MS-DOS that goes way back to version 1.0. MS has known about it for some time but could not or would not fix it. They have corrected the problem with PowerShell.

BTW, if you try:

RD ....

It will fail to delete. You need to use this specific syntax to remove it.

RD ....\

I use this on certain servers that I admin. I often create a user folder on the root of the disk and I don't want another administrator to come along and remove it.

So I will go inside my folder and create a subfolder named CON, AUX, or LPT, etc...

If another Admin wants to remove my folder they need to know how to remove this subfolder first.

EDIT: I was thinking about this discussion this morning and I decided to take this one step further. I assume the mods will decide if this is relevant.

I am unable to CD in to the folder.

Consider, if I MD c:\test then CD C:\test and MD ....\ I end up with C:\test....

and all is well.

But CD .... fails and kicks me back to C:\test. (CD ....\ does the same.)

However I can DIR .... and get a dir listing. I can also

MD C:\test....\temp and it creates that sub-dir in ....

I can also CD C:\test....\temp and go into that sub-sub directory.

But while in C:\test....\temp , if I CD .. I am back in C:\test.

I cannot cd into that directory, but I can manipulate the folder by creating subfolders, and interesting enough something like

ECHO "Testing" >> C:\test....\test.txt

also works and creates a file in that folder. So I can create a folder with four dots, I can add files and folders to it, I can get dir listings of it, but I cannot CD into it. Could there be some kind of evil genius use for this? My apologies to the mods if I have strayed too far off course.