196

The folder name was listed in File Explorer with just plain four dots .....

When I tried opening it, I came into some kind of endless rabbit hole loop where I opened the exact same folder again and again - I could do this endlessly. Showing the path like C:\ExamplePath\....\....\....\....\...., etc.

It was hanging my TypeScript compilation in one specific project. It took me more than a year before I found this folder and its related problems, because it was rooted deeply in nested folders. I never expected an issue like this, so I never looked for it.

I couldn't delete the folder the normal way because of the special name. In the end, I could remove it by using the command line and deleting the parent folder with rd /s /q path.

Afterward, I tried to create the folder again but was unable to do so with both File Explorer and the command line.

In my 20-plus years of using Windows I have never seen this bug before, so I can imagine that it would really be an annoying and confusing problem for amateur users.

Does anyone know how this could have happened and how to reproduce this issue?

Update

For people who are interested: this path was located deep within a TFS folder. So probably TFS uses the bypass method @grawity explained ("Various file managers, archivers, etc")

Did I stumble on a rare TFS bug?

Run5k
  • 16,463
  • 24
  • 53
  • 67
Dirk Boer
  • 1,541

5 Answers5

308

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.
Fabby
  • 645
grawity
  • 501,077
21

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.

legoscia
  • 2,667
18

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.

Larryc
  • 1,054
0

I just experienced such a recursive directory named .... with four dots as well. In my case, I copied data from a Synology NAS to an external M.2 NVMe SSD.

Somehow I ended up with this recursive directory, which was causing problems when copying data to other discs (Windows 10 wasn't even able to define the total size of elements - apparently it recursively visited all elements in the directories).

As mentioned in the accepted answer, I could get rid of the recursive directory by using this command (in the Command Prompt):

rmdir \\?\E:\parent\....

In this case, the recursive directory .... existed as the direct child of a directory named parent.

gru
  • 101
-1

I had the same problem. In my case, it was a typo in command for .NET Core publish:

dotnet publish "Api.csproj" --output "....\output\"

It created the directory with name '....', which I couldn't remove or rename. This directory acted like reference to parent directory. If I go inside that folder, I still was in parent folder, but path was appended by '....\'.

I tried all of the commands mentioned in this topic, but none of them worked. In my understanding, it acted like that, because I had other files and directories in parent directory, so I had to use parameters that can recursively deletes all the content.

I found out, that this command:

rmdir /s /q ....\

can remove the '....' directory. It only deletes the reference to parent directory, which this '....' directory actually is, nothing more, nothing less. Despite the command arguments:

  • /s - removes all the content inside removed directory,
  • /q - removes without confirmation,

the parent directory remained untouched.

Mateusz
  • 11